Hello everyone!
I wrote a VBA program to search column A for the word "hello" in a table. As soon as the word is found in the column, the program transfers the row in the column to the right to a new table. This works fine. Now I want to search for several words at once. Unfortunately, this doesn't work ... Can someone look at the VBA code and tell me what I did wrong? Many thanks in advance!
The Code
Sub test()
T = "T1"
X = "A"
AX = 1
Z = "T4"
Y = 2
AY = "B"
Do Until Suche <> ""
Suche = ("hello"; "my"; "another")
Loop
Set A = Worksheets(T)
Set B = Worksheets(Z)
Y = Y
With A.Columns(X)
Set Gefunden = .Find(Suche, LookIn:=xlValues)
If Not Gefunden Is Nothing Then
Erste = Gefunden.Address
Do 'für alle Fundstellen
B.Cells(Y, AY).Resize(1, AX) = Gefunden.Offset(0, 1).Resize(1, AX).Value
Y = Y + 1
Set Gefunden = .FindNext(Gefunden)
Loop Until Gefunden.Address = Erste
End If
End With
End Sub
Bookmarks