zählenwenn in VBA-Array
14.10.2008 09:14:00
David
folgendes Makro:
Sub finden()
Dim P(12), C(9)
P(1) = Application.WorksheetFunction.Choose(Int(Rnd() * 3) + 1, "A1", "A2", "A3")
... (das packe ich später noch in eine Schleife)
P(12) = Application.WorksheetFunction.Choose(Int(Rnd() * 3) + 1, "B1", "B2", "B3")
C(1) = Application.WorksheetFunction.CountIf(P(), "A1")
End Sub
Ich möchte in dem Array P() zählen, wie oft der Wert A1 vorhanden ist. So wie ich das momentan mache, bekomme ich die Fehlermeldung "Typen unverträglich". Wie geht es richtig?
Danke und Gruß
David