Gruppe
Allgemein
Problem
Wie kann ich ein Tabellenblatt nach einem bestimmten Begriff durchsuchen und die gefundenen Werte in eine zweite Tabelle eintragen lassen?
StandardModule: basMain
Sub FindenUndKopieren()
Dim iRowS As Integer, iRowT As Integer
Dim sWord As String
sWord = InputBox( _
prompt:="Suchbegriff:", _
Default:="Zeile 3 - Spalte 1")
If sWord = "" Then Exit Sub
iRowS = 1
iRowT = 1
With Worksheets("Tabelle2")
Do Until IsEmpty(Cells(iRowS, 1))
If Cells(iRowS, 1) = sWord Then
Rows(iRowS).Copy .Rows(iRowT)
iRowT = iRowT + 1
End If
iRowS = iRowS + 1
Loop
.Columns.AutoFit
.Select
End With
End Sub