Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 334
Default How to make command buttons move among worksheets?

I have command buttons on one worksheet within a workbook spreadsheet. I
want these same buttons to remain as I move from one worsheet to another
within the same spreadsheet. Has anyone done this? Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 221
Default How to make command buttons move among worksheets?

Place them in the top row, and freeze the top row.
*******************
~Anne Troy

www.OfficeArticles.com


"Rick" wrote in message
...
I have command buttons on one worksheet within a workbook spreadsheet. I
want these same buttons to remain as I move from one worsheet to another
within the same spreadsheet. Has anyone done this? Thanks



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 694
Default How to make command buttons move among worksheets?

Hi,

One way would be to create a toolbar instead.

Second way:
To do this, i think it is easier with button from the Forms toolbar instead
of the Control Toolbox toolbar assuming that every Button1 on each sheet call
the same macro:
- Buttons from Forms: you link them to a m,acro that is in a code module.
That is several button can call the same macro easily. No code in the sheet
module.
- buttons from Control Toolbox: they react to a clik and the _Click sub has
to be in the sheet containing the button. Some code has to be in the sheet.

Assuming you are using these buttons from the Forms toolbar:
- link to macros:
-right click each button, choose Assign Macro and pick a macro from the
list (public macros in modules)
- Group them together:
- from the Drawing toolbar, click the Arrow icon to enter Drawing mode,
so that you can select multiple shapes at once.
- grab the buttons, they become selected
- from the Drawing Toolbar, choose menu Draw Group
- click the Arrow from the Drawing toolbar again to leave the drawing mode.
The buttons are now grouped.
- Copy/Paste to other sheets:
- right the group of buttons, choose Copy from the pop-up menu
- go to another sheet and paste
The buttons are now pasted in the other sheet and they have the same
functionality (they call the same macros when clicked)

i hope this helps,
--
Regards,
Sébastien


"Rick" wrote:

I have command buttons on one worksheet within a workbook spreadsheet. I
want these same buttons to remain as I move from one worsheet to another
within the same spreadsheet. Has anyone done this? Thanks

  #4   Report Post  
Posted to microsoft.public.excel.programming
Roy Roy is offline
external usenet poster
 
Posts: 53
Default How to make command buttons move among worksheets?

Rick,

If you don't want to use the tool bar idea, you can paste additional command
buttons on each sheet. Have all of the buttons execute a common subroutine
like this...

Sheet 1 looks like this:
Private Sub CommandButton1_Click()

DoSomeWork 1

End Sub

Public Sub DoSomeWork(SheetIndex As Integer)

Sheets(SheetIndex).Range("E5") = "This is a test"

End Sub

Sheet 2 looks like this:
Private Sub CommandButton1_Click()

DoSomeWork 2

End Sub

and Sheet 3 looks like this:
Private Sub CommandButton1_Click()

DoSomeWork 3

End Sub

I put the public sub right in sheet 1. Sheet 1, 2 and 3 have identical
command buttons with matching left, top, height and width specs, so they
appear to move from one sheet to another as you change sheets. When a
particular sheet's button is clicked, the current sheet index is passed to
the common procedure. You just have to be careful to properly reference
whatever you will be doing in the common procedure off of the sheet index.

The above worked fine in my simple 3 sheet test.

Roy

"Rick" wrote:

I have command buttons on one worksheet within a workbook spreadsheet. I
want these same buttons to remain as I move from one worsheet to another
within the same spreadsheet. Has anyone done this? Thanks

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 694
Default How to make command buttons move among worksheets?

Hello Anne,
I am crossing your way everywhere I go: EE, VBAExpress, Google Answer, ...
and now MS newsgroups :-)
How are you doing?
--
Regards,
Sébastien


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 334
Default How to make command buttons move among worksheets?

Hi Sebastienm. Your suggestion worked. Thanks for the help.
Rick

"sebastienm" wrote:

Hi,

One way would be to create a toolbar instead.

Second way:
To do this, i think it is easier with button from the Forms toolbar instead
of the Control Toolbox toolbar assuming that every Button1 on each sheet call
the same macro:
- Buttons from Forms: you link them to a m,acro that is in a code module.
That is several button can call the same macro easily. No code in the sheet
module.
- buttons from Control Toolbox: they react to a clik and the _Click sub has
to be in the sheet containing the button. Some code has to be in the sheet.

Assuming you are using these buttons from the Forms toolbar:
- link to macros:
-right click each button, choose Assign Macro and pick a macro from the
list (public macros in modules)
- Group them together:
- from the Drawing toolbar, click the Arrow icon to enter Drawing mode,
so that you can select multiple shapes at once.
- grab the buttons, they become selected
- from the Drawing Toolbar, choose menu Draw Group
- click the Arrow from the Drawing toolbar again to leave the drawing mode.
The buttons are now grouped.
- Copy/Paste to other sheets:
- right the group of buttons, choose Copy from the pop-up menu
- go to another sheet and paste
The buttons are now pasted in the other sheet and they have the same
functionality (they call the same macros when clicked)

i hope this helps,
--
Regards,
Sébastien


"Rick" wrote:

I have command buttons on one worksheet within a workbook spreadsheet. I
want these same buttons to remain as I move from one worsheet to another
within the same spreadsheet. Has anyone done this? Thanks

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 221
Default How to make command buttons move among worksheets?

I'm good, Sebastien. And it's very good to see you!
*******************
~Anne Troy

www.OfficeArticles.com


"sebastienm" wrote in message
...
Hello Anne,
I am crossing your way everywhere I go: EE, VBAExpress, Google Answer, ...
and now MS newsgroups :-)
How are you doing?
--
Regards,
Sébastien



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
command buttons disappear when I move worksheet 2007 moulage Excel Discussion (Misc queries) 1 January 25th 10 08:56 PM
Command Button to make multiple duplicate worksheets Roxy Excel Worksheet Functions 0 February 13th 08 06:58 PM
have toggle buttons but everytime print preview buttons move TinSandhu Excel Discussion (Misc queries) 1 October 11th 06 02:57 PM
How do I make my arrow buttons move from cell to cell in Excel? slickd1200 Excel Discussion (Misc queries) 1 April 17th 06 05:42 PM
Use of Command Buttons to Move Through Worksheets golf4 Excel Programming 1 April 11th 04 03:46 PM


All times are GMT +1. The time now is 08:55 AM.

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

About Us

"It's about Microsoft Excel"