Cinema
02-29-2016, 02:31 AM
Hi,
I want to write a macro that searches a word in specific Sheets and then copy the cells right next to it. But I have a Problem with the "Next" command. Where is the error? Can somebody help me please?
Sub Makro1()
Dim ws As Worksheet
Dim rng As Range
Dim sAddress As String
Dim sFind As String
sFind = InputBox("Please enter word to find:")
For Each ws In Worksheets
If ws.Name Like "Table*" Then
Set rng = ws.Cells.Find( _
what:=sFind, _
lookat:=xlWhole, _
LookIn:=xlFormulas)
If Not rng Is Nothing Then
Set rng = ws.Range(rng.Offset(0, 1), rng.End(xlToRight))
Next ws
End If
End Sub
I want to write a macro that searches a word in specific Sheets and then copy the cells right next to it. But I have a Problem with the "Next" command. Where is the error? Can somebody help me please?
Sub Makro1()
Dim ws As Worksheet
Dim rng As Range
Dim sAddress As String
Dim sFind As String
sFind = InputBox("Please enter word to find:")
For Each ws In Worksheets
If ws.Name Like "Table*" Then
Set rng = ws.Cells.Find( _
what:=sFind, _
lookat:=xlWhole, _
LookIn:=xlFormulas)
If Not rng Is Nothing Then
Set rng = ws.Range(rng.Offset(0, 1), rng.End(xlToRight))
Next ws
End If
End Sub