+ Reply to Thread
Results 1 to 3 of 3

Run a macro by the number typed in a box/button

  1. #1
    Registered User
    Join Date
    05-16-2006
    Posts
    6

    Run a macro by the number typed in a box/button

    I want to create a box or button in which I may type a number to run the associated macro.
    For example: My goal is to sort data for each day of the month. I may currently create 31 macro's and 31 buttons, but I would like to have one button/box to run the day that is in need of sorting. I will have 31 macro's, but only one button. Is this possible?

  2. #2
    Forum Contributor
    Join Date
    07-07-2005
    Location
    England
    MS-Off Ver
    Office 2019 Enterprise
    Posts
    462
    I know this may be slightly longer winded than just a text box sat on the screen but hope this helps or at least points in the right direction...

    Keep your button on the sheet and have it call the Macro "InputBox"
    -------------
    Sub InputBox()
    macro = Application.InputBox("Enter Macro Number")
    Run ([macro])
    End Sub
    ------------

    Clicking your button will now open an input box which asks for the macro name you would like to run. If you had a macro called "Print" and entered Print in this box then that macro would run.

    John

  3. #3
    Bob Phillips
    Guest

    Re: Run a macro by the number typed in a box/button

    How about

    Application.Run "Macro" & Day(Date)


    --

    HTH

    Bob Phillips

    (remove nothere from the email address if mailing direct)

    "mcicoff" <[email protected]> wrote in
    message news:[email protected]...
    >
    > I want to create a box or button in which I may type a number to run the
    > associated macro.
    > For example: My goal is to sort data for each day of the month. I may
    > currently create 31 macro's and 31 buttons, but I would like to have one
    > button/box to run the day that is in need of sorting. I will have 31
    > macro's, but only one button. Is this possible?
    >
    >
    > --
    > mcicoff
    > ------------------------------------------------------------------------
    > mcicoff's Profile:

    http://www.excelforum.com/member.php...o&userid=34504
    > View this thread: http://www.excelforum.com/showthread...hreadid=542711
    >




+ 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