Form Option Buttons and Combo Boxes in VBA

N

Newboy18

My spreadsheet is using items from the Form toolbar like
Option Buttons and Combo Boxes, but I don't understand
how to address or control them in VBA.

Another user helped me to clear all Option Buttons:
Dim opt As OptionButton
For Each opt In ActiveSheet.OptionButtons
opt.Value = False
Next opt

This works fine but how do I address a specific Option
Button, if I right click it there is no Properties
option, or do I get it from the Name Box, if that is so I
still can't see it because the Name box is too small?

Please help with 2 examples:
What is the command to set an Option Box to True
What is the command to set a Combo Box to display some
text.
 
B

Bob Phillips

Activesheet.OptinButton s("Option Button 1").Value = xlOn

With ActiveSheet.DropDowns("Drop Down 1")
MsgBox .List(3)
End With

or

With ActiveSheet.DropDowns("Drop Down 1")
MsgBox .List(.ListIndex)
End With

to get the selected value

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top