Simple Command Button

yenrab

New Member
Joined
Mar 21, 2002
Messages
2
I've created a simple command button to goto a range of cells. The button works but I always get Run-time error 1004 Reference is not valid after it works.
Please advise a beginner. Thanks
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
Not sure why it gives you the error. Is there any other info you can give? How are you defining the reference?

I just threw a command button on a worksheet and added the following and I get no errors.
(Note R1C1 notation of reference)

Private Sub CommandButton1_Click()
Application.Goto Reference:="R30C2:R30C6"
End Sub

Any help??

Rgds
AJ
 
Upvote 0
Or, alternatively...

Application.Goto Reference:=Range("A4:N304")

You've gotta use the word "Reference", or else you'll get the runtime error

Rgds
AJ
 
Upvote 0

Forum statistics

Threads
1,214,429
Messages
6,119,433
Members
448,897
Latest member
ksjohnson1970

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top