Visual Basics Error - Goto

S

Shirl

Please help. I keep getting an error from my visual basics code. Click on a
button on a sheet takes you to another sheet within the same workbook then
directly to specific cells. Don't know whats wrong with the code.

Private Sub CommandButton1_Click()
Application.Goto ActiveWorkbook.Sheets("WGTN & KAPITI").Activate
ActiveSheet.Range("Garry").Activate
End Sub
 
D

Dave Peterson

Either:

Private Sub CommandButton1_Click()
Application.Goto ActiveWorkbook.Sheets("WGTN & KAPITI").Range("Garry"), _
scroll:=true 'or false
End Sub

or

Private Sub CommandButton1_Click()
with ActiveWorkbook.Sheets("WGTN & KAPITI")
.Activate
.range("garry").Activate 'or .select
end with
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top