View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
FSt1 FSt1 is offline
external usenet poster
 
Posts: 3,942
Default Selecting sheet with VB

hi
you're trying to select too much at once.
to select a range, the sheet that has the range must be selected first.
dim ws as worksheet
dim ss as range
set ws = sheets("sheet60")
set ss = sheets("sheet60").range("D2")
ws.activate
ss.select

regards
FSt1
"RobN" wrote:

(I posted this in the office.misc newsgroup by mistake)

I've used the following to try and have VB select a sheet dependant on the
value in d2.
Dim ss As Variant
Set ss = Sheet60.Range("d2")

How do I apply that now to select that sheet? I thought something like
sheet(ss).select would do it, but it doesn't work

Sheets(ss).select does work, but doesn't go to the correct sheet number,
whereas Sheet(ss) brings up a "Sub or Function not defined" error.

Rob