+ Reply to Thread
Results 1 to 5 of 5

Thread: Selecting a radio button on another sheet

  1. #1
    Registered User
    Join Date
    12-29-2010
    Location
    Ottawa, Canada
    MS-Off Ver
    Excel 2004 for Mac
    Posts
    20

    Selecting a radio button on another sheet

    Hi,

    I have a macro that references a radio button named "WaiverPrintingONOB" on another worksheet named "Administrator". It doesn't seem to reference it properly though because when the value is true the msgbox still appears.


    If Sheets("Administrator").OptionButtons("WaiverPrintingONOB").Value = True Then
    FR_or_ENForm.Show
    Else
    MsgBox "It works!", vbDefaultButton1, "Test"
    End If
    Can anyone help me reference the button properly?

    Thanks
    Last edited by Einstahb; 10-30-2011 at 09:02 AM.

  2. #2
    Forum Guru 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Vienna, VA, USA
    MS-Off Ver
    Excel 2003, 2007
    Posts
    2,257

    Re: Selecting a radio button on another sheet

    Are you using an ActiveX radio button? (It would help to attach your workbook.) I would have done this, but I'm not sure what your problem is:

     
    If Sheets("Administrator").WaiverPrintingONOB Then
       FR_or_ENForm.Show
    Else
       MsgBox "It works!", vbDefaultButton1, "Test"
    End If
    Making the world a better place one fret at a time
    ||||||

    If someone helped you, please click on the star icon at the bottom of their post

    If your problem is solved, please update the first post:
    EDIT, Go Advanced button, set Prefix to SOLVED

    [code]
    ' Enclose code in tags like this
    [/code]

    Don't attach a screenshot
    --just attach your Excel file! It's easier and will let us experiment with your data, formulas, and code.

  3. #3
    Registered User
    Join Date
    12-29-2010
    Location
    Ottawa, Canada
    MS-Off Ver
    Excel 2004 for Mac
    Posts
    20

    Re: Selecting a radio button on another sheet

    Hi,

    Thanks for the reply. The code you provided still doesn't seem to work. I've attached a file with the function.The radio button is on the "administrator" page. The command button that runs the macro is on the "Waiver" page.


    Joel
    Attached Files Attached Files

  4. #4
    Forum Guru 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Vienna, VA, USA
    MS-Off Ver
    Excel 2003, 2007
    Posts
    2,257

    Re: Selecting a radio button on another sheet

    You are using the older "form" controls. My advice was for ActiveX controls.

    A form control radio button has a value of 1 if it's on, and -4146 if it's off (don't ask me). So you could go back to your original code, checking for those values.

  5. #5
    Registered User
    Join Date
    12-29-2010
    Location
    Ottawa, Canada
    MS-Off Ver
    Excel 2004 for Mac
    Posts
    20

    Re: Selecting a radio button on another sheet

    Thanks for your help. With the proper value, the code works perfectly!


    If Sheets("Administrator").OptionButtons("WaiverPrintingONOB").Value = 1 Then
    FR_or_ENForm.Show
    Else
    MsgBox "It works!", vbDefaultButton1, "Test"
    End If

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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