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

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
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,213,494
Messages
6,113,974
Members
448,537
Latest member
Et_Cetera

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