View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Hutchins Tom Hutchins is offline
external usenet poster
 
Posts: 1,069
Default checkbox code needed

Try this in your userform code (you may have to change the object names):

Private Sub UserForm_Terminate()
Dim OutStr As String
If Me.CheckBox1.Value = True Then
OutStr$ = "Mech & "
End If
If Me.CheckBox2.Value = True Then
OutStr$ = OutStr$ & "Elect & "
End If
If Me.CheckBox3.Value = True Then
OutStr$ = OutStr$ & "Inst/FET & "
End If
ActiveCell.Offset(0, 9).Value = Left(OutStr$, Len(OutStr$) - 3)
End Sub

Hope this helps,

Hutch

"Woodi2" wrote:

I have 3 checkboxes on a userform. The Userform is opened if anycell in
range C4:C100 is selected. Checkbox 1 if true = "Mech", Checkbox 2 if true =
"Elect" and Checkbox 3 if true = "Inst/FET".
I need some code so that if for example Checkbox 1 and 2 are true, then
Activecell.offset (0,9) is returned with Mech & Elect.
Similiarly, if Checkbox 1, 2 and 3 are true it returns Mech & Elect &
Inst/FET.
I need this to work in all combinations. Is it possible?