Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 16
Default Sow do i make a userform know if a value is true in a frame, then

I am trying to make a list that will list what catagory and items chosen in
that catagory. For example, Catagory is animals. WHen i generate the list i
want the program to List the Catagory and then list any true (checked)
values in the frame in the userform. If there are no checked boxes then i
want it to skip the output for that frame. I know i can write it like this

Range("A1").select
If cat.value=false and dog.value=false and ... Then
Else

If cat.value=true Then
activecell.value=cat
activecell.offset(1,0).select
End If
If dog.value=true Then
activecell.value=dog
activecell.offset(1,0).select
End If
End If

After this the next frame with a different catagory would go through its code.

Is there any way to shorten the code using a loop or some other method? I
will have close to 100 or more items in the final list and i want to make it
more simple in the code.

Thanks, CSUS_CE_Student
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,365
Default Sow do i make a userform know if a value is true in a frame, then

Not being able to see everything, and not knowing if your checkbox names are
actually as you've described them here, I'll take a stab at it anyhow. This
assumes that the control names are in the Caption portion of the checkbox.
In other words you have checkboxs that appear as the box with text like "Dog"
or "Cat" or "Horse" displayed. You have a button on the form Named
ShowTrueSelections - will probably have several sections of code similar to
this, one for each grouping. I'm just having hard time picturing how your
form is set up. Maybe this will at least give you some ideas on how to
attack it.

Private Sub ShowTrueSelections_Click()
Dim ctl As Control

Range("A1").Select
For Each ctl In Me.Controls
If TypeName(ctl) = "CheckBox" And ctl = True Then
ActiveCell = ctl.Caption
ActiveCell.Offset(1, 0).Activate
End If
Next

End Sub



"CSUS_CE_Student" wrote:

I am trying to make a list that will list what catagory and items chosen in
that catagory. For example, Catagory is animals. WHen i generate the list i
want the program to List the Catagory and then list any true (checked)
values in the frame in the userform. If there are no checked boxes then i
want it to skip the output for that frame. I know i can write it like this

Range("A1").select
If cat.value=false and dog.value=false and ... Then
Else

If cat.value=true Then
activecell.value=cat
activecell.offset(1,0).select
End If
If dog.value=true Then
activecell.value=dog
activecell.offset(1,0).select
End If
End If

After this the next frame with a different catagory would go through its code.

Is there any way to shorten the code using a loop or some other method? I
will have close to 100 or more items in the final list and i want to make it
more simple in the code.

Thanks, CSUS_CE_Student

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
how do i make a button from a userform exit onto the document in . Pieface New Users to Excel 1 April 17th 07 07:35 PM
How to make userform work publically with hidden sheets? Zigball Excel Discussion (Misc queries) 7 October 25th 06 03:30 PM
How can I make an excel cell equal to the value of a frame object text box directionalman Excel Worksheet Functions 1 February 27th 06 09:24 PM
How to attach legend frame to chart frame? holg3r Charts and Charting in Excel 2 July 7th 05 11:41 PM
VBA: Disable Frame and Radio Buttons based on Another Radio Button Being True Mcasteel Excel Worksheet Functions 2 October 29th 04 07:06 PM


All times are GMT +1. The time now is 09:58 PM.

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"