3-position switch control

J

jafsonic

I would like to allow a user to select data with 3 options. I've used
checkboxes when the option is just on or off (incomplete or
complete). Sometimes the data does not apply, so I'd like a
"checkbox" which allows 3 conditions: N/A, on (complete), and off
(pending/incomplete).

I'm already using VBA macros to implement changes based on the
checkboxes. It would be nice to tie code options based on a 3 (or
more) position switch control. Is there such a thing?
 
J

John Bundy

I like spin buttons. Use the spin up and down to cycle through the options
and display in a textbox.

Dim myOption As Integer
Dim DisplayText As String

Private Sub SpinButton1_SpinDown()
myOption = myOption - 1
If myOption = 0 Then myOption = 3
SetText
End Sub
Private Sub SpinButton1_SpinUp()
If myOption = 3 Then myOption = 0
myOption = myOption + 1
SetText
End Sub
Private Sub UserForm_Activate()
myOption = 1
SetText
End Sub
Sub SetText()
If myOption = 1 Then TextBox1.Text = "N/A"
If myOption = 2 Then TextBox1.Text = "On (complete)"
If myOption = 3 Then TextBox1.Text = "Off (pending/incomplete)"

End Sub
 
J

jafsonic

Consider a userform with radio buttons
--
Gary''s Student - gsnu200813






- Show quoted text -

Thanks. I thought about a userform option and even radio buttons on
the sheet, but wasn't going that way since this a relatively simple
status page intended for real-time updating in front of an audience
who probably arent' going to want to watch you navigate forms. It may
still be an option though.
 
J

jafsonic

I like spin buttons. Use the spin up and down to cycle through the options
and display in a textbox.

Dim myOption As Integer
Dim DisplayText As String

Private Sub SpinButton1_SpinDown()
myOption = myOption - 1
If myOption = 0 Then myOption = 3
SetText
End Sub
Private Sub SpinButton1_SpinUp()
If myOption = 3 Then myOption = 0
myOption = myOption + 1
SetText
End Sub
Private Sub UserForm_Activate()
myOption = 1
SetText
End Sub
Sub SetText()
If myOption = 1 Then TextBox1.Text = "N/A"
If myOption = 2 Then TextBox1.Text = "On (complete)"
If myOption = 3 Then TextBox1.Text = "Off (pending/incomplete)"

End Sub

--
-Johnhttp://jmbundy.blogspot.com
Please rate when your question is answered to help us and others know what
is helpful.






- Show quoted text -

Yeah, ok, that's an option. I worry a little about real estate since
there may be a lot of these on a sheet, but it would be clear to use
either a spin button or even just a list/combo box.

Hmm... maybe a double-click option on a checkbox would work to turn
the state from active to N/A, then a single click for pending vs.
complete. What do you think?
 
J

Jim Cone

Set the TripleState property to True
--
Jim Cone
Portland, Oregon USA



"jafsonic"
wrote in message
I would like to allow a user to select data with 3 options. I've used
checkboxes when the option is just on or off (incomplete or
complete). Sometimes the data does not apply, so I'd like a
"checkbox" which allows 3 conditions: N/A, on (complete), and off
(pending/incomplete).

I'm already using VBA macros to implement changes based on the
checkboxes. It would be nice to tie code options based on a 3 (or
more) position switch control. Is there such a thing?
 

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