Thread: VB
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Harald Staff Harald Staff is offline
external usenet poster
 
Posts: 1,327
Default VB

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 message with this code in Excel?
There is something wrong in this line: Range("A1").Select


Private Sub CommandButton1_Click()
Sheets("Forecast").Select
Range("A1").Select
End Sub