View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
FSt1 FSt1 is offline
external usenet poster
 
Posts: 3,942
Default Specifying the Sheet

hi
unless otherwise specified, the find assumes you are searching the active
sheet. if you wish to search other or all sheets do this....
Sub mac1FindAll()
Dim c As String
Dim sh As Worksheet
Dim rng As Range
c = InputBox("Enter item to search for")
For Each sh In ActiveWorkbook.Worksheets
If c < "" Then
Set rng = Nothing
Set rng = sh.Range("A1:IV65000").Find(what:=c, _
After:=sh.Range("A1"), _
LookIn:=xlFormulas, _
lookat:=xlPart, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
End If
If Not rng Is Nothing Then
sh.Activate
rng.Select
MsgBox "Found on sheet " & sh.Name & " at cell " & _
rng.Address

regards
FSt1

"kirkm" wrote:

Hi, in the following -

Dim foundCell As Range
Set foundCell = Selection.Find(What:=Format(ChosenDate, "dd mmm
yyyy"), _
After:=Cells(rows.Count, 1), _
LookIn:=xlFormulas, _
LookAt:=xlPart, _
SearchOrder:=xlByColumns, _
SearchDirection:=xlNext, _
MatchCase:=False, _
SearchFormat:=False)

whereabouts would you specify the Sheet Name ?

And does the command

foundCell.Select

Move to a different sheet, if that's where foundCell is ?

Many thanks - Kirk