Hi Everyone,
This macro is working exactly as I want it to - except that it is incredibly slow:
I have changed the S.Range to B4:B50000 (as this is all that actually needs searching), thinking a smaller search range may speed it up.
Also - The worksheet it's searching was in an xls (2003) workbook, and was telling be about a compatibility issue when saving, so I copied it to a new xlsm (2007) workbook, but it is still super slow.
If I search for the last entry - using the macro - it takes 3.5 minutes!
Any ideas on wht's going wrong and how to make it fast?
Thanks
This macro is working exactly as I want it to - except that it is incredibly slow:
Code:
Sub myfind()
Dim Message, Title, Default, SearchString
Message = "Enter the name you need to find.." & vbNewLine & "(not case sensitive)" ' Set prompt.
Title = "Find ? On all sheets!" ' Set title.
Default = "" ' Set default.
' Display message, title, and default value.
SearchStart: 'THIS IS THE NEW CODE FROM MR EXCEL
SearchString = InputBox(Message, Title, Default)
Set S = Sheets.Application
For Each S In Application.Sheets
With S.Range("A1:IV65536")
Set F = .Find(SearchString, MatchCase:=False, LookAt:=xlPart, LookIn:=xlValues)
If F Is Nothing Then
MsgBox "I can't see " & SearchString & " in the list!"
GoTo SearchStart 'THIS IS THE NEW CODE FROM MR EXCEL
Else
Location = F.Address
S.Select
Range(Location).Select
End If
Exit For
End With
Next S
End Sub
Also - The worksheet it's searching was in an xls (2003) workbook, and was telling be about a compatibility issue when saving, so I copied it to a new xlsm (2007) workbook, but it is still super slow.
If I search for the last entry - using the macro - it takes 3.5 minutes!
Any ideas on wht's going wrong and how to make it fast?
Thanks