Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default Help: Multiple Checkboxes (, naming and visibility)

Hey gang,

I am having a hell of a time trying to work out how to fix my checkbox
needs.

I have a form (UserForm2) which I could now work out how to add checkboxes
to whilst the program was running so i added them to the user form itself.

I have 75 of them. I have overlapped them so I have 3 per line side by side
so people can choose any one or all of three options for each line.

Because the variable name for the objects is a straightforward variable, I
am now finding I cannot address each of these in the program such as I would
if I could in an arrange. Eg I have to address checkbox1 rather than
checkbox(1). The latter would be good in arrays, even if you couldaddress
the names such as Checkbox("Checkbox1")

So I a was wondering how i would address each out.

I need to make all checkboxes invisible except for ones that relate to lines
irequire. Lines are determined by how many lines of reference numbers are
put into userform1.

I also require each series of 3 checkboxes names to the reference number.
Therefore only every 3 hasit's label populated.

Anybody able to point me in the right direction?

I have read some things but it's lost me and I assume because my level of
programming is more intermediate than advanced and I come from the old basic
and pascal days, therefore objects aren't my forte.

Help is appreciated and thank you in advance.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Help: Multiple Checkboxes (, naming and visibility)

You could go through the controls collection:

Dim iCtr as long
for iCtr = 1 to 75
msgbox me.controls("checkbox" & ictr).value
next ictr
==============

Same thing with the visibility stuff
Dim NumberOfLines as long
dim iCtr as long

numberoflines = 8
for ictr = (numberoflines * 3 + 1) to 75
me.controls("checkbox" & ictr).visible = false
next ictr


Clinton M James wrote:

Hey gang,

I am having a hell of a time trying to work out how to fix my checkbox
needs.

I have a form (UserForm2) which I could now work out how to add checkboxes
to whilst the program was running so i added them to the user form itself.

I have 75 of them. I have overlapped them so I have 3 per line side by side
so people can choose any one or all of three options for each line.

Because the variable name for the objects is a straightforward variable, I
am now finding I cannot address each of these in the program such as I would
if I could in an arrange. Eg I have to address checkbox1 rather than
checkbox(1). The latter would be good in arrays, even if you couldaddress
the names such as Checkbox("Checkbox1")

So I a was wondering how i would address each out.

I need to make all checkboxes invisible except for ones that relate to lines
irequire. Lines are determined by how many lines of reference numbers are
put into userform1.

I also require each series of 3 checkboxes names to the reference number.
Therefore only every 3 hasit's label populated.

Anybody able to point me in the right direction?

I have read some things but it's lost me and I assume because my level of
programming is more intermediate than advanced and I come from the old basic
and pascal days, therefore objects aren't my forte.

Help is appreciated and thank you in advance.


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default Help: Multiple Checkboxes (, naming and visibility)

Hi Dave,

Thanks for trying to help but I am still having problems.

The method you sggest doesn't seem to have an option to change the captions
and even if itdid i can't get it to work as it is.

I have 2 userforms and these are in the second userform.

Is there a special place i should put my code

What happens is I have it get a list of numbers from a textbox in
userform1... then when a person clicks, it will grab each line from the
textbox and split each line into its own part of an array.

For every third checkbox in userform2, i want to change the caption to the
name in the digits in the corresponding array, providing the array has a
value.
If the arrays cease to have a value at some point, i needthe remainder of
checkboxes invisible.

I think my main problem besides the lack of a caption option is that I am
putting code into thewrong part.

I playedaroundand put a sub into Userform2 and I could not call it from a
sub in Userform1

how i load userform2 is by declaring userform2.show

I may be doing this wrong too.

Help is very appreciated if it is possible.

"Dave Peterson" wrote in message
...
You could go through the controls collection:

Dim iCtr as long
for iCtr = 1 to 75
msgbox me.controls("checkbox" & ictr).value
next ictr
==============

Same thing with the visibility stuff
Dim NumberOfLines as long
dim iCtr as long

numberoflines = 8
for ictr = (numberoflines * 3 + 1) to 75
me.controls("checkbox" & ictr).visible = false
next ictr


Clinton M James wrote:

Hey gang,

I am having a hell of a time trying to work out how to fix my checkbox
needs.

I have a form (UserForm2) which I could now work out how to add
checkboxes
to whilst the program was running so i added them to the user form
itself.

I have 75 of them. I have overlapped them so I have 3 per line side by
side
so people can choose any one or all of three options for each line.

Because the variable name for the objects is a straightforward variable,
I
am now finding I cannot address each of these in the program such as I
would
if I could in an arrange. Eg I have to address checkbox1 rather than
checkbox(1). The latter would be good in arrays, even if you couldaddress
the names such as Checkbox("Checkbox1")

So I a was wondering how i would address each out.

I need to make all checkboxes invisible except for ones that relate to
lines
irequire. Lines are determined by how many lines of reference numbers are
put into userform1.

I also require each series of 3 checkboxes names to the reference number.
Therefore only every 3 hasit's label populated.

Anybody able to point me in the right direction?

I have read some things but it's lost me and I assume because my level of
programming is more intermediate than advanced and I come from the old
basic
and pascal days, therefore objects aren't my forte.

Help is appreciated and thank you in advance.


--

Dave Peterson



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Help: Multiple Checkboxes (, naming and visibility)

You can change 75 captions by using something like:

Dim iCtr as long
for iCtr = 1 to 75
me.controls("checkbox" & ictr).caption = "capt" & ictr
next ictr

I think I'd have an Ok button somewhere on the form and put the code that
hides/shows the checkboxes in that button's click event.

I'm not sure how you get the name in the digits in the corresponding array, but
you could loop through every third checkbox like:

Dim iCtr as long
for iCtr = 3 to 75 step 3 'start with the 3rd checkbox
me.controls("checkbox" & ictr).caption = "whatever caption you need"
next ictr

And to hide/show the checkboxes, you could use:

Dim SomeNumber as long
somenumber = 15 'show the first 15
for ictr = 1 to 75
me.controls("Checkbox" & ictr).visible = cbool(ictr <= somenumber)
next ictr

'or if you like
for ictr = 1 to 75
if ictr <= somenumber then
me.controls("Checkbox" & ictr).visible = true
else
me.controls("Checkbox" & ictr).visible = false
end if
next ictr





Clinton M James wrote:

Hi Dave,

Thanks for trying to help but I am still having problems.

The method you sggest doesn't seem to have an option to change the captions
and even if itdid i can't get it to work as it is.

I have 2 userforms and these are in the second userform.

Is there a special place i should put my code

What happens is I have it get a list of numbers from a textbox in
userform1... then when a person clicks, it will grab each line from the
textbox and split each line into its own part of an array.

For every third checkbox in userform2, i want to change the caption to the
name in the digits in the corresponding array, providing the array has a
value.
If the arrays cease to have a value at some point, i needthe remainder of
checkboxes invisible.

I think my main problem besides the lack of a caption option is that I am
putting code into thewrong part.

I playedaroundand put a sub into Userform2 and I could not call it from a
sub in Userform1

how i load userform2 is by declaring userform2.show

I may be doing this wrong too.

Help is very appreciated if it is possible.

"Dave Peterson" wrote in message
...
You could go through the controls collection:

Dim iCtr as long
for iCtr = 1 to 75
msgbox me.controls("checkbox" & ictr).value
next ictr
==============

Same thing with the visibility stuff
Dim NumberOfLines as long
dim iCtr as long

numberoflines = 8
for ictr = (numberoflines * 3 + 1) to 75
me.controls("checkbox" & ictr).visible = false
next ictr


Clinton M James wrote:

Hey gang,

I am having a hell of a time trying to work out how to fix my checkbox
needs.

I have a form (UserForm2) which I could now work out how to add
checkboxes
to whilst the program was running so i added them to the user form
itself.

I have 75 of them. I have overlapped them so I have 3 per line side by
side
so people can choose any one or all of three options for each line.

Because the variable name for the objects is a straightforward variable,
I
am now finding I cannot address each of these in the program such as I
would
if I could in an arrange. Eg I have to address checkbox1 rather than
checkbox(1). The latter would be good in arrays, even if you couldaddress
the names such as Checkbox("Checkbox1")

So I a was wondering how i would address each out.

I need to make all checkboxes invisible except for ones that relate to
lines
irequire. Lines are determined by how many lines of reference numbers are
put into userform1.

I also require each series of 3 checkboxes names to the reference number.
Therefore only every 3 hasit's label populated.

Anybody able to point me in the right direction?

I have read some things but it's lost me and I assume because my level of
programming is more intermediate than advanced and I come from the old
basic
and pascal days, therefore objects aren't my forte.

Help is appreciated and thank you in advance.


--

Dave Peterson


--

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
Multiple checkboxes and aligning Dudedad Excel Discussion (Misc queries) 2 June 26th 07 07:28 PM
Multiple Checkboxes Annie Excel Discussion (Misc queries) 2 June 11th 07 05:06 PM
Multiple Checkboxes Shortcut? Jason Excel Discussion (Misc queries) 1 October 18th 05 08:08 PM
Multiple checkboxes, one macro? pkohler[_10_] Excel Programming 6 July 1st 05 06:54 PM
Multiple checkboxes 1 macro George J Excel Programming 6 October 15th 03 04:50 PM


All times are GMT +1. The time now is 09:16 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"