Hello,
Thank you in advance to answer my question!
I'm a beginner in VBA and i'm working on some code that can help me out to count the total number of specific product from the cell, for example in column B it contained different shoes brand with quantity we sold, i want to know the total number of adidas we sold on the entire column B, so I select the option box says adidas then click on count button, it will then give me the result of 6 next to Label1, below is my code but seems not work.
Please note that the data that i received is system generated and data are contained in one cell by new line, so that is complicated for me.
Please also see attachment of how my userform look like.
Private Sub Count_Click()
Dim result As Double
'Assign the variable
result = Application.WorksheetFunction.CountIf(Range("B2:B50"), "adidas")
'Show the result
Label1.Caption = "result"
End Sub
Thanks and appreciate that!
Thank you in advance to answer my question!
I'm a beginner in VBA and i'm working on some code that can help me out to count the total number of specific product from the cell, for example in column B it contained different shoes brand with quantity we sold, i want to know the total number of adidas we sold on the entire column B, so I select the option box says adidas then click on count button, it will then give me the result of 6 next to Label1, below is my code but seems not work.
Please note that the data that i received is system generated and data are contained in one cell by new line, so that is complicated for me.
Please also see attachment of how my userform look like.
Private Sub Count_Click()
Dim result As Double
'Assign the variable
result = Application.WorksheetFunction.CountIf(Range("B2:B50"), "adidas")
'Show the result
Label1.Caption = "result"
End Sub
Thanks and appreciate that!