WorksheetFunction.Match
24.11.2005 14:24:37
loca
ich hab ein problem mit der WorksheetFunction.Match. Wenn ich in der ersten For-Schlaufe Cells(i, "A").Value = 21 - i statt Cells(i, "A").Value = i schreibe, bricht das Makro bei der Funktion Cells(i, "C").Value = WorksheetFunction.Match(i, country()) ab. Kann mir jemand sagen, was ich tun muss, damit das nicht passiert?
Besten Dank und Gruss
loca
Sub Makro1()
For i = 1 To 20
Cells(i, "A").Value = 21 - i
Next i
Dim country()
For i = 1 To 20
ReDim Preserve country(i)
country(i) = Cells(i, "A")
Next i
For i = 1 To 20
Cells(i, "B").Value = country(i)
Next i
For i = 1 To 20
Cells(i, "C").Value = WorksheetFunction.Match(i, country())
Next i
End Sub