Solved

Excel radio button code

Posted on 2013-01-29
8
838 Views
Last Modified: 2013-02-20
I have an Excel 97-2003 worksheet that has radio button controls. In design view, when I right click and pick Assign Macro, I see a macro named, for example, OptionButton8448_Click, but there is no way to edit the VBA code. The radio button does indeed causes cells to update, so there must be VBA code firing somewhere. My quesion is: how do I get a the VBA code behind the radio button? thanks!
0
Comment
Question by:paulmcneil
  • 5
  • 2
8 Comments
 
LVL 26

Expert Comment

by:redmondb
ID: 38833336
Hi, paulmcneil.

A couple of things...
(1) While it can be linked to a macro, this kind of Option Button doesn't need one to effect changes.
(2) Your button doesn't have a macro. When you pick "Assign Macro", Excel proposes a macro name usually (?always?) based on the button's name - "OptionButton8448_Click",in your case.

how do I get a the VBA code behind the radio button?
Not the code, but to see what it's doing, right-click on it, pick "Format Control..." and click on the Control tab. You should see there the cell that's updated when the button is pressed/unpressed.

Regards,
Brian.
0
 
LVL 46

Expert Comment

by:Martin Liss
ID: 38833468
If I understand you correctly, to to "get at the VBA code" all you need to do is to go to the Macros menu, highlight the OptionButton8448_Click macro, and then click Edit.
0
 

Author Comment

by:paulmcneil
ID: 38835610
Brian, you've got me headed there. I see the Cell link in the Control tab of the Format Control form for each radio button control. Another aspect of this is the radio button controls are grouped, so I can see a group box around the group of 7 radio buttons. This group of seven radio buttons are all linked to the same cell. When one button is clicked the value in the linked cell changes. How is the value that appears in the linked cell get assigned to each radio button in the group?
0
 
LVL 26

Expert Comment

by:redmondb
ID: 38835789
paulmcneil,

It would make things clearer if you could delete any sensitive information and post the file here. (Alternatively paste the group box and buttons into a new file and post that.)

Thanks,
Brian.
0
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 

Author Comment

by:paulmcneil
ID: 38836179
OK Brian. Attached is the workbbok. Click on any radio button in row 9, columns F-L and you'll see a vlue associated with the button display in cell W8 - Where does that value come from? Thanks
JobStandard.xlsx
0
 
LVL 26

Expert Comment

by:redmondb
ID: 38836503
Thanks, paulmcneil.

The easy question is where it comes from - within a group the oldest button gets 1, the next 2 and so on.

I've been trying to find out where that information is held - so far without success, but I'm still on it!

Regards,
Brian.
0
 
LVL 26

Accepted Solution

by:
redmondb earned 500 total points
ID: 38846075
paulmcneil,

Assuming xShape is a Shape variable set to an Option Button then...
xShape.OLEFormat.Object.Index
...is the value that will appear in the linked cell.

(A word of caution - this is from my own digging around rather than any documentation that I found.)

Regards,
Brian.
0
 
LVL 26

Expert Comment

by:redmondb
ID: 38912173
Thanks, paulmcneil.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Delete all words in cell more than 5 words 7 47
excel pivot question 4 41
Tags from access to excel 3 31
Excel 2010 Text Formatting placing a hyphen in front of text 3 20
The System Center Operations Manager 2012, known as SCOM, is a part of the Microsoft system center product that provides the user with infrastructure monitoring and application performance monitoring. SCOM monitors:   Windows or UNIX/LinuxNetwo…
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now