Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Excel radio button code

Posted on 2013-01-29
8
Medium Priority
?
868 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 49

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
Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

 
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
 

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 2000 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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
Windows Explorer let you handle zip folders nearly as any other folder: Copy, move, change, and delete, etc. In VBA you can also handle normal files and folders, but zip folders takes a little more - and that you'll find here.
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.

916 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