원하는 결과를 제공하기 위해 3 가지 값을 곱해야하는 양식이 있습니다. 그것은 다음과 같습니다 :VBA로 곱하기
Private Sub cmdAdd_Click()
Dim emptyRow As Long
Dim ctl As Control
Dim A As Integer
Dim B As Integer
Dim C As Integer
Dim D As Integer
Dim E As Integer
Dim Answer As Integer
Dim Answer2 As Integer
Dim Answer3 As Integer
If Me.txtNoTotalAff.Value = "" Then
MsgBox "Please enter the Total Number of Affiliates", vbExclamation, "ROI"
Me.txtNoTotalAff.SetFocus
Exit Sub
End If
If Me.lstClientName.Value = "" Then
MsgBox "Please enter Client Name", vbExclamation, "ROI"
Me.lstClientName.SetFocus
Exit Sub
End If
'Determine Empty Row
emptyRow = Worksheets("ROI").Range("A1").CurrentRegion.Rows.Count
A = txtNoTotalAff.Value
B = txtActiveAff.Value
C = txtAvgTraffic.Value
D = txtConvRate.Value
E = txtAOV.Value
Answer = A * B
Answer2 = Answer * C
Answer3 = (Answer2 * D) * E
'Transfer Information
With Worksheets("ROI").Range("A1")
.Offset(emptyRow, 0).Value = lstClientName.Value
.Offset(emptyRow, 1).Value = txtNoTotalAff.Value
.Offset(emptyRow, 2).Value = txtActiveAff.Value
.Offset(emptyRow, 3).Value = Answer
.Offset(emptyRow, 4).Value = txtAvgTraffic.Value
.Offset(emptyRow, 5).Value = Answer2
.Offset(emptyRow, 6).Value = txtConvRate.Value
.Offset(emptyRow, 7).Value = txtAOV.Value
.Offset(emptyRow, 8).Value = Answer3
.Offset(emptyRow, 9).Value = txtAffName.Value
End With
'Clear the Form
For Each ctl In Me.Controls
If TypeName(ctl) = "TextBox" Or TypeName(ctl) = "ComboBox" Then
ctl.Value = ""
ElseIf TypeName(ctl) = "CheckBox" Then
ctl.Value = False
End If
Next ctl
End Sub
나는 변수를 사용하고 각을 계산하도록하거나 필요하거나 내가 원하는 결과를 얻을 수있는 답변 자체를 사용하고 싶습니다.
어떻게하면됩니까?
당신이 여기있는 코드에 어떤 문제가 있습니까? 당신은 당신이 가진 문제 (또는 솔직히, 당신이 해결하려고하는 문제)를 설명하지 못했습니다. –
이 글을 읽으려면 어떻게해야하는지에 대한 몇 가지 차이점이 있습니다. 그 차이점 중 하나의 결과로 오류가 있다고 가정해야합니다. 당신의 잘못은 무엇입니까? – peege
먼저 숫자를 가변적으로 숫자로 변환하지 않고 텍스트를 곱하려고 시도하는 데 문제가 있다고 생각합니다. 게시 한 코드의 논리가 훌륭하고 제대로 작동하는 것처럼 보입니다. – peege