This does not work: Range("A1").Select

  • Thread starter Thread starter Bob
  • Start date Start date
B

Bob

Why do I get an error with this?


Private Sub CommandButton1_Click()
Sheets("Forecast").Select
Range("A1").Select
End Sub
 
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
 
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.
 
Back
Top