Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 71
Default checkboxes and option buttons

XP pro, xl2002

hi i have a userform with several checkboxes. if any of them are checked i
want their captions to be concatenated together with some text in a textbox
to be transferred together into another textbox at the click of a button.

eg, textbox1 = "TVC"
checkbox1 = checked (caption "-1")
checkbox2 = unchecked (caption "-2")
checkbox3 = checked (caption "-3")

so, textbox2 would = "TVC-1-3"

i CAN do all of this, but want to know if there is an efficient way of
working through each checkbox (of which there are 7)

subsequently, a smilar solution for the optionbuttons (although, obviously
only one will be 'true')

in addition (if it makes a difference), all the checkboxes are in one frame
and the option buttons in another frame - these are bth enclosed in another
frame... currently for aesthetic purposes, but don't know if it makes any
difference to what i want to achieve. can i refer to all objects enclosed in
a frame?

thanks all,

tim


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default checkboxes and option buttons

If your checkboxes are nicely named: checkbox1 through checkbox7, then maybe
something like:

Option Explicit
Private Sub CommandButton1_Click()

Dim iCtr As Long
Dim myStr As String

myStr = Me.TextBox1.Value
For iCtr = 1 To 7
With Me.Controls("checkbox" & iCtr)
If .Value = True Then
myStr = myStr & .Caption
End If
End With
Next iCtr

Me.TextBox2.Value = myStr

End Sub



Tim wrote:

XP pro, xl2002

hi i have a userform with several checkboxes. if any of them are checked i
want their captions to be concatenated together with some text in a textbox
to be transferred together into another textbox at the click of a button.

eg, textbox1 = "TVC"
checkbox1 = checked (caption "-1")
checkbox2 = unchecked (caption "-2")
checkbox3 = checked (caption "-3")

so, textbox2 would = "TVC-1-3"

i CAN do all of this, but want to know if there is an efficient way of
working through each checkbox (of which there are 7)

subsequently, a smilar solution for the optionbuttons (although, obviously
only one will be 'true')

in addition (if it makes a difference), all the checkboxes are in one frame
and the option buttons in another frame - these are bth enclosed in another
frame... currently for aesthetic purposes, but don't know if it makes any
difference to what i want to achieve. can i refer to all objects enclosed in
a frame?

thanks all,

tim


--

Dave Peterson

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Buttons shrinking and checkboxes swelling... Geoff[_5_] Excel Discussion (Misc queries) 6 February 6th 10 07:39 PM
My CheckBoxes and Option Buttons Grow/Shrink each time I click the Memphis Excel Discussion (Misc queries) 1 April 15th 09 08:51 PM
creating checkboxes and radio buttons in excel Sandeep Excel Worksheet Functions 1 December 3rd 08 11:54 AM
Checkboxes vs. Option Buttons JW_4222 Excel Discussion (Misc queries) 2 February 1st 06 01:38 PM
Excel: unlocking buttons & checkboxes Lee Excel Programming 0 September 24th 03 01:41 PM


All times are GMT +1. The time now is 02:51 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"