Hey Guys,
Need some quick help if possible. Need to get this code to just run on the second and third sheet in my workbook.
Need some quick help if possible. Need to get this code to just run on the second and third sheet in my workbook.
Code:
Sub myLogedFindAll()
'Standard module code, like: Module1.
Dim ws As Worksheet, Found As Range
Dim myText As String, FirstAddress As String
Dim AddressStr As String, foundNum As Integer
myText = Sheets(1).Cells(1, 2)
If myText = "" Then Exit Sub
Worksheets("Sheet1").Cells.ClearContents
For Each ws In ThisWorkbook.Worksheets
With ws
If ws.Name = "Sheet1" Then GoTo myNext
Set Found = .UsedRange.Find(what:=myText, LookIn:=xlValues, LookAt:=xlPart, MatchCase:=False)
If Not Found Is Nothing Then
FirstAddress = Found.Address
Do
foundNum = foundNum + 1
AddressStr = AddressStr & .Name & " " & Found.Address & vbCrLf
Set Found = .UsedRange.FindNext(Found)
Found.Copy _
Destination:=Worksheets("Sheet1").Range("B65536").End(xlUp).Offset(1, 0)
Worksheets("Sheet1").Range("B65536").End(xlUp).Offset(0, 1) = _
"On: " & Found.Worksheet.Name & ", " & _
"Cell: " & Found.Address(RowAbsolute:=False, ColumnAbsolute:=False)
Loop While Not Found Is Nothing And Found.Address <> FirstAddress
End If
myNext:
End With
Next
End Sub