Gruppe
Allgemein
Problem
Es soll geprüft werden, ob die Werte aus Spalte E in Spalte A vorhanden sind. Wenn ja, soll in Spalte F eine SVERWEIS-Formel eingesetzt werden.
StandardModule: Modul1
Sub SetVLookup()
Dim vRow As Variant
Dim iRow As Integer
iRow = 2
Do Until IsEmpty(Cells(iRow, 1))
vRow = Application.Match(Cells(iRow, 5).Value, Columns(1), 0)
If Not IsError(vRow) Then
Um die Formel einzutragen
Cells(iRow, 6).Formula = "=VLOOKUP(" & Cells(iRow, 5).Address & ",A:A,0)"
Um Werte einzutragen:
'Cells(iRow, 6).Value = _
WorksheetFunction.VLookup(Cells(iRow, 5).Value, Columns(1), 0)
End If
iRow = iRow + 1
Loop
End Sub