Linking Radio Buttons for Test

Discussion in 'General Software' started by LordVankar, May 11, 2012.

  1. LordVankar

    LordVankar

    Joined:
    May 10, 2012
    Messages:
    6
    Likes Received:
    0
    I have been reading a lot of comments on how to use radio buttons and have been seeing a lot fo different versions. What I am looking for is a scoring system. So in my worksheet which I cannot seem to attach, I have inserted the Group Box and four option buttons, each located in cells k19,20,21 and 22 I want the option buttons to link to cell K18, with the answer of A,B,C, or D. I have only provided one set as once I get the code for it I am sure I can copy the rest.
     
    LordVankar, May 11, 2012
    #1
    1. Advertisements

  2. LordVankar

    Stoneboysteve VIP Member

    Joined:
    Sep 3, 2008
    Messages:
    161
    Likes Received:
    0
    Location:
    USA
    Create the radio buttons then shift click to select them, right click and group them.
    Right click on the first one, select format control, select the cell you want to link.
    When I just tested it with a group of four buttons the linked cell values were 1, 2, 3, and 4.

    Steve
     
    Stoneboysteve, May 12, 2012
    #2
    1. Advertisements

  3. LordVankar

    LordVankar

    Joined:
    May 10, 2012
    Messages:
    6
    Likes Received:
    0
    Thanks. That worked, but I need to change the numbers to letters, which I managed but not the way it should be. See code below. If I had a separate subroutine for each radio button then it would work, but when they are combined under the same subroutine, it only comes up with one of the letters, and it comes up with an error stating that it "can't execute in break mode." Perhaps you know how to shorten this and make it a simpler code?

    Sub QUESTION_1()
    '
    ' QUESTION_1 Macro
    '
    '
    ActiveSheet.Shapes("1A").Select
    If Range("K18").Select Then
    ActiveCell.FormulaR1C1 = "A"

    Else

    ActiveSheet.Shapes("1B").Select
    If Range("K18").Select Then
    ActiveCell.FormulaR1C1 = "B"

    Else

    ActiveSheet.Shapes("1C").Select
    If Range("K18").Select Then
    ActiveCell.FormulaR1C1 = "C"

    Else

    ActiveSheet.Shapes("1D").Select
    If Range("K18").Select Then
    ActiveCell.FormulaR1C1 = "D"
    End If
    End If
    End If
    End Sub
     
    LordVankar, May 14, 2012
    #3
  4. LordVankar

    LordVankar

    Joined:
    May 10, 2012
    Messages:
    6
    Likes Received:
    0
    I have it figured out, but only if each of the buttons have their own subroutine but are linked to the same cell. So if there is another way that someone knows to combine those into one subroutine, that would be appeciated.

    Sub Button_1A()
    ActiveSheet.Shapes("1A").Select
    Range("K18").Select
    ActiveCell.FormulaR1C1 = "A"

    End Sub

    Sub Button_1B()
    ActiveSheet.Shapes("1B").Select
    Range("K18").Select
    ActiveCell.FormulaR1C1 = "B"

    End Sub
    Sub Button_1C()
    ActiveSheet.Shapes("1C").Select
    Range("K18").Select
    ActiveCell.FormulaR1C1 = "C"

    End Sub
    Sub Button_1D()
    ActiveSheet.Shapes("1D").Select
    Range("K18").Select
    ActiveCell.FormulaR1C1 = "D"

    End Sub
     
    LordVankar, May 14, 2012
    #4
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Abarbarian

    BBC iPlayer - Radio Downloader

    Abarbarian, Jan 9, 2011, in forum: General Software
    Replies:
    6
    Views:
    8,122
    floppybootstomp
    Feb 11, 2011
  2. SunbeamFanatic

    Linking Hotmail to Outlook

    SunbeamFanatic, Mar 15, 2011, in forum: General Software
    Replies:
    1
    Views:
    1,172
    Silverhazesurfer
    Mar 24, 2011
  3. LordVankar

    RADIO BUTTON LINKS SWITCHING BACK TO NUMBER

    LordVankar, May 14, 2012, in forum: General Software
    Replies:
    1
    Views:
    521
    LordVankar
    May 14, 2012
  4. Quadophile

    Peacekeeper - The ultimate browser test

    Quadophile, Apr 16, 2013, in forum: General Software
    Replies:
    12
    Views:
    1,226
    Quadophile
    Apr 17, 2013
  5. Lazarusomega2000

    Test Building Application in Access 2007/2010

    Lazarusomega2000, May 13, 2013, in forum: General Software
    Replies:
    0
    Views:
    581
    Lazarusomega2000
    May 13, 2013
Loading...

Share This Page