Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 470
Default Ref Commandbutton

Please forgive my last post. It was early in the morning when I read your
answer and brain was not working. This is what I tried:

I changed the code for the commandbutton that changes to STATS sheet to

FROM:
Private Sub CommandButton4_Click()
Application.Goto Reference:=Worksheets("STATS").Range("A1")
End Sub

TO:
Sub CommandButton4_Click()
'Call Stats
End Sub

I placed the following code in the "ThisWorkbook" module

Sub Stats()
Application.Goto Reference:=Worksheets("STATS").Range("A1")
End Sub


I get a "Sub or Function not defined" compile error.

LEs

"Gary''s Student" wrote:

Put your common code in a standard module. Your various button macros can
reference the common code:

Sub Button2_Click()
Call master
End Sub


Sub master()
MsgBox (" ")
End Sub
--
Gary''s Student - gsnu200769


"WLMPilot" wrote:

I have a workbook with several sheets pertaining to my work schedule,
paychecks, stats, etc. On each sheet, I have a command button for sheet so I
can click on the button and change sheets. Thus, I have several command
buttons that reference one sheet.

Is there a way to have these command buttons reference one set of code so
that I only have to enter the code to change to that sheet once?

Thanks,
Les

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
commandbutton? Bobbykm Excel Programming 3 September 30th 07 01:13 AM
Commandbutton alvin Kuiper Excel Programming 6 November 27th 05 06:28 PM
CommandButton Alvin Hansen[_2_] Excel Programming 3 August 16th 04 06:35 PM
CommandButton chris[_12_] Excel Programming 1 April 15th 04 01:01 AM
CommandButton rwebster3 Excel Programming 0 April 14th 04 08:16 PM


All times are GMT +1. The time now is 12:13 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"