+ Reply to Thread
Results 1 to 5 of 5

Adding macro button: which option?

  1. #1
    Forum Contributor terrypin's Avatar
    Join Date
    01-06-2010
    Location
    East Grinstead, UK
    MS-Off Ver
    MS Office 365
    Posts
    533

    Adding macro button: which option?

    The instructions I’ve read on how to add a macro button are usually like this:

    1. Go to the Developer tab in the ribbon.
    2. Press the Insert button found in the Controls section.

    But the next step varies. Some say

    3. Select the Button Form Control.

    But others say

    3. Select the Active X control.

    Is there any consensus on this or advice on when to use a particular option please?
    Terry, East Grinstead, UK
    Excel 365, Win 10 Pro, i7 PC, 4.0 GHz

  2. #2
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Adding macro button: which option?

    The Form button is less quirky than the Active X button. AND it is cross platform with a Mac (which doesn't support ActiveX)

    Unless there is a good reason to use the ActiveX version, I'd go with the Forms button. Note that the code for the attached macro should be in a normal module, not the sheet's code module.
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  3. #3
    Forum Contributor terrypin's Avatar
    Join Date
    01-06-2010
    Location
    East Grinstead, UK
    MS-Off Ver
    MS Office 365
    Posts
    533

    Re: Adding macro button: which option?

    Thanks Mike, I’ll choose that.

    I’m a VBA novice so could you expand on the distinction you’ve made about module types please?

  4. #4
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Adding macro button: which option?

    In the VB Editor, if you double click on worksheet (or the ThisWorkbook icon) in the Project Explorer, the code module for that sheet will open.
    The event code (Worksheet_Change, Worksheet_Calculate, etc) code for that sheet goes in that module. So does the event code for ActiveX controls.

    If you use the menu to Insert>Module (not Class Module, not Userform) a normal code module will be added to the workbook. General code (that can be called from any module) goes there.

    Subs in a Sheet's code module can only be called by refering to the sheet
    Please Login or Register  to view this content.
    and then only if you declare the sub as Public.
    In a normal module, Public is the default type of Sub, and code can be called without refering to the module
    Please Login or Register  to view this content.

  5. #5
    Forum Contributor terrypin's Avatar
    Join Date
    01-06-2010
    Location
    East Grinstead, UK
    MS-Off Ver
    MS Office 365
    Posts
    533

    Re: Adding macro button: which option?

    Thanks Mike, understood.

+ 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. [SOLVED] Adding a third option to a button
    By sungen99 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-29-2016, 11:53 AM
  2. Option Button to call macro
    By deek in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-13-2016, 03:21 PM
  3. [SOLVED] Macro to hide option button
    By TomBP in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-09-2013, 11:34 AM
  4. option button macro
    By arnab0711 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-01-2011, 02:07 AM
  5. Create Option Button using Macro
    By Budi in forum Excel General
    Replies: 1
    Last Post: 08-28-2009, 04:15 AM
  6. Using macro to create option button
    By Andrew-Mark in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-17-2009, 06:49 AM
  7. Adding option "button" to excel sheet
    By LadyFinisher in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-08-2009, 11:33 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