+ Reply to Thread
Results 1 to 6 of 6

Calling command button from another sheet

  1. #1
    Ian
    Guest

    Calling command button from another sheet

    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

  2. #2
    Jim Thomlinson
    Guest

    RE: Calling command button from another sheet

    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...
    --
    HTH...

    Jim Thomlinson


    "Ian" wrote:

    > 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
    >


  3. #3
    Ian
    Guest

    Re: Calling command button from another sheet

    Thanks jim,

    I am using the button from the control toolbox.

    cheers




    On Wed, 12 Apr 2006 08:58:02 -0700, Jim Thomlinson
    <James_Thomlinson@owfg-Re-Move-This-.com> wrote:

    >I



  4. #4
    Jim Thomlinson
    Guest

    Re: Calling command button from another sheet

    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
    --
    HTH...

    Jim Thomlinson


    "Ian" wrote:

    > Thanks jim,
    >
    > I am using the button from the control toolbox.
    >
    > cheers
    >
    >
    >
    >
    > On Wed, 12 Apr 2006 08:58:02 -0700, Jim Thomlinson
    > <James_Thomlinson@owfg-Re-Move-This-.com> wrote:
    >
    > >I

    >
    >


  5. #5
    Ian
    Guest

    Re: Calling command button from another sheet


    thanks for your help.
    cheers

    On Wed, 12 Apr 2006 09:16:02 -0700, Jim Thomlinson
    <James_Thomlinson@owfg-Re-Move-This-.com> wrote:

    >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



  6. #6
    Registered User
    Join Date
    10-20-2014
    Location
    India
    MS-Off Ver
    2007
    Posts
    1

    Re: Calling command button from another sheet

    As you said "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..."

    Sir i have buttons from the forms toolbar attach to macros stored in standard
    code modules...
    can you help me with code.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1