Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Why do I get an error with this?
Private Sub CommandButton1_Click() Sheets("Forecast").Select Range("A1").Select End Sub |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi
Probably because that code is in Sheet3. From there you have very limited power over Sheet1. Put code like this in standard modules and call them from the sheets. Like: Sub GoForecast() Sheets("Forecast").Select Range("A1").Select End Sub and in the sheet: Private Sub CommandButton1_Click() Call GoForecast End Sub -- HTH. Best wishes Harald Followup to newsgroup only please. "Bob" wrote in message ... Why do I get an error with this? Private Sub CommandButton1_Click() Sheets("Forecast").Select Range("A1").Select End Sub |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Private Sub CommandButton1_Click()
Sheets("Forecast").Select Range("A1").Select End Sub Because the unqualified Range("A1").Select refers to the sheet containing the button which is not the active sheet Private Sub CommandButton1_Click() With Sheets("Forecast") .Select .Range("A1").Select End Sub Should work. -- regards, Tom Ogilvy "Bob" wrote in message ... Why do I get an error with this? Private Sub CommandButton1_Click() Sheets("Forecast").Select Range("A1").Select End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
please change Range("AB30").Select to any cell | Excel Worksheet Functions | |||
"Select method of Range class failed" Error | Excel Discussion (Misc queries) | |||
Using "=randbetween" to select a number from a range of cells | Excel Worksheet Functions | |||
Run-time error "1004" Select method of range class failed | Excel Discussion (Misc queries) | |||
Why doesn't "Workbook.Range("myrange").value" work? | Excel Programming |