Calling command button from another sheet

  • Thread starter Thread starter Ian
  • Start date Start date
I

Ian

I have a workbook with 6 sheets inside.
5 have data and each have one button to process the data.

i require to run each button from the first sheet to get a summary
of the data.

how do i call the buttons on the other sheets and display the data
on the first.

thanks
 
That depends entirely on what kind of buttons you have. There are 2 types of
buttons. Buttons from the forms toolbar attach to macros stored in standard
code modules. To run those you can just run the macro's. You may need to
select the appropraite sheet with the buttons prior to calling the macros if
the code references the active sheet. If the buttons are from the control
toolbox then the code can be run by changing the scope fo the button from
private to public and then you can access the button fairly easily. Let me
know which buttons you have if you need more info that this...
 
Assuming you have a button embeded in sheet1 (code name) called
CommandButton1...

goto to the code for the buttons and change it to Public...
Public Sub CommandButton1_Click()

Now in a sub in sheet 2 you should be able to reference the button using
Sub TestButtons
Call Sheet1.CommandButton1_Click
end sub
 
Back
Top