A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Visual Basics Error - Goto



 
 
Thread Tools Display Modes
  #1  
Old February 20th, 2010, 09:55 PM posted to microsoft.public.excel.newusers
Shirl
external usenet poster
 
Posts: 14
Default Visual Basics Error - Goto

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
--
Shirl, NZ
  #2  
Old February 20th, 2010, 10:33 PM posted to microsoft.public.excel.newusers
Dave Peterson
external usenet poster
 
Posts: 19,791
Default Visual Basics Error - Goto

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

Shirl wrote:

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
--
Shirl, NZ


--

Dave Peterson
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 06:27 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.