VBA Index,Vergleich
20.02.2014 10:38:24
Thorsten
ich beschäftige mich das erste Mal mit VBA-Formel und bekomme es natürlich nicht hin.
Und zwar wollte ich diese Formel umsetzen:
=WENNFEHLER(INDEX(Import!K1:K5000;VERGLEICH(OVD!AA1;Import!A1:A5000;0));"Keine Angabe")
Das Ergebnis soll dann nur in einer Msgbox angezeigt werden.
Sub Test ()
Dim a As Range ' Bereich
Dim b As Range ' Suchbereich
Dim y As Range ' Suchkriterium
Dim x As Variant
Set a = Sheets("Import").Range("K1 : K5000")
Set b = Sheets("Import").Range("A1 : A5000")
Set y = Sheets("OVD").Range("AA1")
With Application.WorksheetFunction
x = .IfError(Index(a, .Match((.y(b)), b, 0)), ("Keine Angabe"))
End With
MsgBox x
End Sub
Wie muss "x=" aussehen oder ist der Ansatz schon falsch?Bitte um Hilfe.
Gruß Thorsten