View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Doug Glancy[_8_] Doug Glancy[_8_] is offline
external usenet poster
 
Posts: 63
Default Specifying the Sheet

Kirk,

Find takes as it's first argument a range. In the case of your code that
range is the Selection. Selection only applies to the active sheet. What
your other two answers are saying is that in order to to work on a sheet
other than the activesheet, you'll have to specify the sheet and the range.
So instead of

Set foundCell = Selection.Find(What:=Format(ChosenDate, "dd mmm yyyy")

you'd have something like:

Set foundCell = Worksheets("Sheet
2").Range("A1:D200").Find(What:=Format(ChosenDa te, "dd mmm yyyy")

If you want to search the same cells as the current Selection but on a sheet
other than the Activesheet, I think you could do this:

Dim strSelectionAddress As String
strSelectionAddress = Selection.Address
Set foundCell = Worksheets("Sheet
2").Range(strSelectionAddress).Find(What:=Format(C hosenDate, "dd mmm yyyy")

hth,

Doug

"kirkm" wrote in message
...
On Sun, 21 Oct 2007 13:22:05 +1300, kirkm wrote:

Thanks for the answers but sorry I couldn't get
what I wanted from either.

I know the sheet name, that piece of code I pasted currently works
on the active sheet but I may (depending on user input)
want to specify a differnet sheet.

Cheers - Kirk