+ Reply to Thread
Results 1 to 6 of 6

Macro to open up message box with radio button options

  1. #1
    Forum Contributor
    Join Date
    08-29-2017
    Location
    Canada
    MS-Off Ver
    Window 2013
    Posts
    127

    Macro to open up message box with radio button options

    Hi Experts,

    I need assistance I would like to be able to hit control K (macro) and then have a message box pop up that has 4 radio button options in which state , Run, Delete data, Run end of day.

    Then depending which one you choose it will accomplish the task.

    Thank you!

    Noah

  2. #2
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,951

    Re: Macro to open up message box with radio button options

    You could use a UserForm to do this.

    In the attached press Ctrl+k and the form will show up. Select an option then click the 'Do it' button, a message box will pop up in this example but in reality you'd change the coding to fire your macros instead.

    BSB
    Attached Files Attached Files

  3. #3
    Forum Contributor
    Join Date
    08-29-2017
    Location
    Canada
    MS-Off Ver
    Window 2013
    Posts
    127

    Re: Macro to open up message box with radio button options

    Thanks Badly!

    this looks really Good, I'm guessing then in the back end I just put in the code to the macro that I want done under each user form. So then when I click an option it will do just that.

  4. #4
    Forum Contributor
    Join Date
    08-29-2017
    Location
    Canada
    MS-Off Ver
    Window 2013
    Posts
    127

    Re: Macro to open up message box with radio button options

    Wow it works fantastic !

    Thank you! one more thing can you give me just some quick notes on how you built the user form, I see it in the back end so that's fine but I just need a few steps how you got the radio buttons and all.


    so step 1, then step 2 ect.

    I would appreciate that!

    Thank you!

  5. #5
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,951

    Re: Macro to open up message box with radio button options

    No problem. Simple as this...

    1) Press Alt+F11 to open the VB Editor
    2) Right click near the top left where it says "VBAProject (YourWorkbookNameHere)"
    3) Select "Insert / UserForm"
    4) A floating menu called "Toolbox" should appear. If not, select "View/Toolbox"
    5) From there you can drag and drop the different control types onto the UserForm, resize, reposition etc.

    Then simply a case of learning how they all work and how to program them Have fun with it.

    Worth noting that in the attachment to post #2 I used a CommandButton on the form. You could (and I think this is what you were alluding to in post #3) use click or change events on each of the radio buttons so when they're selected the relevant code fires (without the need to click the 'GO' button). The reason I didn't do that is I build userforms every day and I know that humans are quite likely to click on a radio button by accident and do something they didn't want. Then you have to put everything right for them. The CommandButton is a safety net in the middle. You can even code it so a message box pops up saying "Are you sure????" before the code fires, just to be on the safe side

    Shout if you have more questions.

    BSB

  6. #6
    Forum Contributor
    Join Date
    08-29-2017
    Location
    Canada
    MS-Off Ver
    Window 2013
    Posts
    127

    Re: Macro to open up message box with radio button options

    Hi Badly,

    no worries all works good, I totally understand now how it works, thanks for you help! this is really good.

    Noah

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 2
    Last Post: 12-06-2017, 11:33 AM
  2. [SOLVED] Test for file open from Command Button on userform - not displaying open already message
    By nigelog in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-02-2017, 09:45 AM
  3. Replies: 3
    Last Post: 01-07-2015, 12:19 PM
  4. how macro can detect a radio button
    By ursanil in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-20-2012, 03:46 AM
  5. Replies: 7
    Last Post: 11-22-2011, 01:29 AM
  6. macro code depanding on radio button
    By prajakt in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-19-2011, 08:27 AM
  7. Pressing one radio button to select another radio button
    By raehippychick in forum Excel General
    Replies: 1
    Last Post: 09-13-2007, 11:30 PM

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