Userform ... populate optionbutton from spreadsheet

V

VBAwannabe

Hi

I have a userform which adds/updates staff information - this has been
achieved by the fantastic resource that this forum is.

My userform has three option buttons which I can populate to the
spreadsheet by the caption of the selected option button - what I am
having trouble with is populating the optionbuttons from the
spreadsheet to the userform. I have the textboxes etc covered (from
userform to spreadsheet and spreadsheet to userform), just stumped on
the optionbuttons ...

My optionbuttons are within a frame titled; "Employment status",
permanent, temporary and ex-employee.

I had originally fixed this by removing my optionbuttons, and using a
textbox, however the optionbuttons I believe is the easiest for the
user, and limits the entries.

I can add in the code that I am using within the next 24 hours - my
spreadsheet is on my work pc.

Appreciate any assistance with this matter.
Thanx, Tania
 
B

Bob Phillips

What's this, a warning that you will post a real question later?

Maybe something like

Select Case Range("M1").Value
Case "Full-time": optStatus1.Value = True
Case "Part-time": optStatus2.Value = True
Case "Casual": optStatus3.Value = True
End Select



--

HTH

Bob Phillips

(replace xxxx in the email address with gmail if mailing direct)
 
V

VBAwannabe

Thanx Bob - over the w/e I will modify the code I have to your
suggestion :()
Tania
 
V

VBAwannabe

If Me.optPermanent = True Then
Cells(lCurrentRow, 4).Value = "Permanent"
ElseIf Me.optTemporary = True Then
Cells(lCurrentRow, 4).Value = "Temporary"
Else
Cells(lCurrentRow, 4).Value = "Ex Employee"
End If

Hi Bob,
Your select Case scenario put it in context for me ... and I used the
above code to load info back into my spreadsheet.

Thank you for your time - with your assistance/advice I managed to sort
it :)

Tania
 
V

VBAwannabe

If Me.optPermanent = True Then
Cells(lCurrentRow, 4).Value = "Permanent"
ElseIf Me.optTemporary = True Then
Cells(lCurrentRow, 4).Value = "Temporary"
Else
Cells(lCurrentRow, 4).Value = "Ex Employee"
End If

Hi Bob,
Your select Case scenario put it in context for me ... and I used the
above code to load info back into my spreadsheet.

Thank you for your time - with your assistance/advice I managed to sort
it :)

Tania
 
B

Bob Phillips

Good, glad you are sorted.

--

HTH

Bob Phillips

(replace xxxx in the email address with gmail 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