+ Reply to Thread
Results 1 to 4 of 4

Linking a VBA Form Radio Button to a Option Button

  1. #1
    Registered User
    Join Date
    05-09-2013
    Location
    Toronto
    MS-Off Ver
    Excel 2003
    Posts
    56

    Linking a VBA Form Radio Button to a Option Button

    Hello,

    I have a radio button in my VBA userform. I want to link this radio button to a Option button in Sheet1. I think you do it via the control source bu when i type

    Please Login or Register  to view this content.
    it doesnt work

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Linking a VBA Form Radio Button to a Option Button

    This is from the VBA help for ControlSource Property

    ControlSource Property


    Identifies the data location used to set or store the Value property of a control. The ControlSource property accepts worksheet ranges from Microsoft Excel.

    Syntax

    object.ControlSource [= String]

    The ControlSource property syntax has these parts:

    Part Description
    object Required. A valid object.
    String Optional. Specifies the worksheet cell linked to the Value property of a control.


    Remarks


    The ControlSource property identifies a cell or field; it does not contain the data stored in the cell or field. If you change the Value of the control, the change is automatically reflected in the linked cell or field. Similarly, if you change the value of the linked cell or field, the change is automatically reflected in the Value of the control.

    You cannot specify another control for the ControlSource. Doing so causes an error.

    The default value for ControlSource is an empty string. If ControlSource contains a value other than an empty string, it identifies a linked cell or field. The contents of that cell or field are automatically copied to the Value property when the control is loaded.

    Set both option buttons (userform and worksheet) control sources to the same cell address e.g. Sheet1!A1
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Linking a VBA Form Radio Button to a Option Button

    Hi buwa84,

    Thank you AlphaFrog for introducing me to the ControlSource Property

    The control source property does not apply to a single option button in a Spreadsheet, but to the group: http://msdn.microsoft.com/en-us/libr...ice.15%29.aspx

    Having said that I was unsuccessful linking any Worksheet 'Active X' control using ControlSource.

    However I was successful using ControlSource with UserForm Option Buttons.

    To link UserForm Option Buttons to a cell (please note this is bi-directional):
    Please Login or Register  to view this content.
    Lewis

  4. #4
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Linking a VBA Form Radio Button to a Option Button

    I was successful in making UserForm Option Buttons control Forms Options Buttons and 'Active X' Option Buttons on the worksheet.

    In the UserForm code module:
    Please Login or Register  to view this content.
    Lewis

+ 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] Linking Option Button(Control Form) to Shapes
    By Heva in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 09-17-2013, 05:24 AM
  2. Linking Option Button(Control Form) to Shapes
    By Heva in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-16-2013, 03:37 AM
  3. Hide a picture button placed in all sheets using a option button (form control)
    By lagaranch in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-26-2012, 10:33 AM
  4. VBA User Form - Linking Close Button and Cancel Button
    By nivassrii in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-26-2011, 07:05 AM
  5. [SOLVED] Radio or option button
    By Susan in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 02-14-2006, 11:40 AM

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