View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ed Ed is offline
external usenet poster
 
Posts: 399
Default "Select" and "Activate" failing?

Thank you, sonu. Activating the sheet first did the trick.
Ed

"sonu" wrote in message
ups.com...
or you can use the following two lines

Worksheets("Sheet1").activate
Worksheets("Sheet1").Range("A1").Select

You can not select a range unless that sheet is already
activated(selected)

Hope this helps.


Die_Another_Day wrote:
I don't know why but the work around I use is:
Application.GoTo Sheets("Sheet1").Range("A1")

Charles

Ed wrote:
I have a Workbook_Open macro as follows:

Private Sub Workbook_Open()

Worksheets("Sheet2").Visible = True
Worksheets("Sheet3").Visible = xlVeryHidden
Worksheets("Sheet1").Visible = True
Worksheets("Sheet1").Range("A1").Select

End Sub

The last line fails with " "Select" method of "Range" class failed." I
then
changed it to
Worksheets("Sheet1").Range("A1").Activate
and got the same failure error. Why?

Ed