Hi
my proble is simple, but i am new to vba programming so be patient please.
I have a table with numbers in different rows (kind of stupid remark, since its excel!). The numbers in the rows stand for a product line. As there are several different products in one product line the same number might come up more than once in one row.
I would now like to count the number of product lines in a coulumn, hence the number of different entries in a column. For example in coulmn J the entries might be: 10 10 10 12 12 12 12 17. I want the makros to display "There are 3 different product lines".
I tried this
but it it says "Error 6: Overflow"Sub Test()
Dim i As Integer
Dim Anzahl As Integer
Dim Zahl As Integer
Zahl = 369490
Anzahl = 1
i = 2
While Not IsEmpty(Cells(10, i))
If Cells(10, i) = Zahl Then
i = i + 1
Else
Zahl = Zahl + 1
Anzahl = Anzahl + 1
End If
Wend
MsgBox "Es gib " & Anzahl & " verschiedene Sendungen!"
End Sub
Any suggestions?
Thanks!
Bookmarks