PC Review


Reply
Thread Tools Rate Thread

Linking Radio Buttons for Test

 
 
New Member
Join Date: May 2012
Posts: 6
 
      11th May 2012
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.
 
Reply With Quote
 
 
 
 
Senior Member
Stoneboysteve's Avatar
Join Date: Sep 2008
Location: USA
Posts: 154
 
      12th May 2012
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
 
Reply With Quote
 
 
 
 
New Member
Join Date: May 2012
Posts: 6
 
      14th May 2012
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
 
Reply With Quote
 
New Member
Join Date: May 2012
Posts: 6
 
      14th May 2012
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
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ASP.NET Reset Radio Button in a group of Radio Buttons Scott D Johnson Microsoft ASP .NET 1 27th Sep 2006 11:38 PM
Outlook 2007 - HTML radio buttons, submit buttons, text fields... =?Utf-8?B?bWlndWVsaXRvOTI4?= Microsoft Outlook Discussion 2 13th Sep 2006 08:20 PM
test test test test jadfl Microsoft Dot NET Framework 1 6th Jul 2005 06:31 AM
VBA: Disable Frame and Radio Buttons based on Another Radio Button Being True Mcasteel Microsoft Excel Worksheet Functions 2 29th Oct 2004 07:06 PM
Options Buttons, not Radio Buttons Bob Microsoft Access VBA Modules 1 29th Jul 2004 11:23 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:15 AM.