Unfortunately.... I tried to make it better and now I'm facing a problem ^^"
So I have this which is working fine:
Private Sub ParaCajas()
For i = 1 To 7
If Me.Controls("SKU" & i).Value <> "" Then
With Me.Controls("Price" & i)
If DistribsOB.Value = True Then
.Value = amntcases(sOutlet = "Distribuitors")
ElseIf FarmaciasIOB.Value = True Then
.Value = amntcases(sOutlet = "Pharmacy Distribuitors")
ElseIf WHDOB.Value = True Then
.Value = amntcases(sOutlet = "Sales Force Wholesalers")
ElseIf DepDentOB.Value = True Then
.Value = amntcases(sOutlet = "DEPOSITOS DENTALES")
ElseIf FarmaciasDOB.Value = True Then
.Value = amntcases(sOutlet = "Drugstores")
ElseIf HiperOB.Value = True Then
.Value = amntcases(sOutlet = "Hypermarkets")
ElseIf SuperOB.Value = True Then
.Value = amntcases(sOutlet = "Supermarkets")
ElseIf ClubsOB.Value = True Then
.Value = amntcases(sOutlet = "Clubs")
ElseIf TiendasDepOB.Value = True Then
.Value = amntcases(sOutlet = "Department Stores")
End If
End With
Next
End Sub
But then I have this:
Private Function amntcases(sOutlet As String) As Double
i = 1
With Me.Controls("SKU" & i)
amntcases = Format(WorksheetFunction.Round(WorksheetFunction.SumIf(Sheet2.Range("A:A"), .Value, Sheet2.Range("D:D")) - (WorksheetFunction.SumIfs(Sheet9.Range("I:I"), Sheet9.Range("E:E"), sOutlet, Sheet9.Range("H:H"), .Value) / 100) * WorksheetFunction.SumIf(Sheet2.Range("A:A"), .Value, Sheet2.Range("D:D")), 2), "Currency")
End With
End Function
which is working fine as well BUT only because it has i = 1 :P
What I'm trying to do is:
use the same counter in "ParaUnidades" for "amntcases".
Bookmarks