Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
"Select" and "Activate" failing?
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
"Select" and "Activate" failing?
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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
"Select" and "Activate" failing?
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 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
"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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell | Excel Discussion (Misc queries) | |||
change "true" and "false" to "availble" and "out of stock" | Excel Worksheet Functions | |||
HELP on "left","right","find","len","substitute" functions | Excel Discussion (Misc queries) | |||
Count occurences of "1"/"0" (or"TRUE"/"FALSE") in a row w. conditions in the next | New Users to Excel | |||
Using "Cells" to write "Range("A:A,H:H").Select" | Excel Programming |