Im unteren Code wird in einer UserForm gezählt wie oft ein Wert in Spalde D vorkommt.
Es zählt aber immer um eines zuviel.
Zum Beispiel ein Wert ist in Spalte "D" 12 mal eingetragen, Auswertung sagt aber 13 mal vorgekommen.
Wüsste jemand woran das liegt?
Danke, Heinz
Private Sub CommandButton1_Click()
Dim e As Object, intZ As Integer
intZ = 1
For Each e In Sheets("Artikelliste").Range("D2:D" & Sheets("Artikelliste").Cells(Rows.Count, 4). _
End(xlUp).Row)
If e.Value = CLng(TextBox1.Value) Then
Sheets("Artikelliste").Cells(e.Row, 5).Value = TextBox2.Value
intZ = intZ + 1
End If
Next e
MsgBox "Wert wurde " & intZ & " mal gefunden", vbInformation, "Hinweis"
End Sub