Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 244
Default Checking a userForm that has not been initialized

Ok I do not know if this is possible but let me describe the setting. I have
a userform that is shown when the user presses a button on a spreadsheet. the
userform lets the user enter a start date and an end date. these dates refer
to a number of charts that are to be created by my macro. the user can
specify which charts that are to be created be selecting checkboxes, each
chekbox indicates a chart. I used to have all this on the same userform but
it created a problem beacuse the userfom got so big so it was impossible to
use it. Thus i want to change it so that the user specifies the start date
and end date on one userform and then if the user so whishes can press a
button on the first userform that displays the second userform. the second
userform lets the user choose how many charts that are to be selected. the
problem is that this needs to be optional. this means that if the user does
not choose to see the second userform the code must still work i.e. the
program chooses the default setting for the number of charts. I know how to
solve this if you simply choose a number as default. however I need to keep
it variable. my code now counts the number of checkboxes but is that possible
to do when using two userforms where the second one is optional? I do not
know if this makes any sense but please help me out if you understand me.
Thanks alot!!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Checking a userForm that has not been initialized

in a general module

Public NumCharts


in Userform1

Private Sub Userform_Initialize()
NumCharts = 10
End Sub

in Userform 2
code that counts the checkboxes and sets NumCharts.

Somewhere else - code that uses numcharts to create the number of charts.

--
Regards,
Tom Ogilvy


"Arne Hegefors" wrote:

Ok I do not know if this is possible but let me describe the setting. I have
a userform that is shown when the user presses a button on a spreadsheet. the
userform lets the user enter a start date and an end date. these dates refer
to a number of charts that are to be created by my macro. the user can
specify which charts that are to be created be selecting checkboxes, each
chekbox indicates a chart. I used to have all this on the same userform but
it created a problem beacuse the userfom got so big so it was impossible to
use it. Thus i want to change it so that the user specifies the start date
and end date on one userform and then if the user so whishes can press a
button on the first userform that displays the second userform. the second
userform lets the user choose how many charts that are to be selected. the
problem is that this needs to be optional. this means that if the user does
not choose to see the second userform the code must still work i.e. the
program chooses the default setting for the number of charts. I know how to
solve this if you simply choose a number as default. however I need to keep
it variable. my code now counts the number of checkboxes but is that possible
to do when using two userforms where the second one is optional? I do not
know if this makes any sense but please help me out if you understand me.
Thanks alot!!

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 244
Default Checking a userForm that has not been initialized

thanks Tom!! My problem is that the default value for NumCheckBoxes cannot be
a random number but I need the actual number of CheckBoxes. Is that possible
at all? Would really appreciate help! Thanks again for your assistance!

"Tom Ogilvy" skrev:

in a general module

Public NumCharts


in Userform1

Private Sub Userform_Initialize()
NumCharts = 10
End Sub

in Userform 2
code that counts the checkboxes and sets NumCharts.

Somewhere else - code that uses numcharts to create the number of charts.

--
Regards,
Tom Ogilvy


"Arne Hegefors" wrote:

Ok I do not know if this is possible but let me describe the setting. I have
a userform that is shown when the user presses a button on a spreadsheet. the
userform lets the user enter a start date and an end date. these dates refer
to a number of charts that are to be created by my macro. the user can
specify which charts that are to be created be selecting checkboxes, each
chekbox indicates a chart. I used to have all this on the same userform but
it created a problem beacuse the userfom got so big so it was impossible to
use it. Thus i want to change it so that the user specifies the start date
and end date on one userform and then if the user so whishes can press a
button on the first userform that displays the second userform. the second
userform lets the user choose how many charts that are to be selected. the
problem is that this needs to be optional. this means that if the user does
not choose to see the second userform the code must still work i.e. the
program chooses the default setting for the number of charts. I know how to
solve this if you simply choose a number as default. however I need to keep
it variable. my code now counts the number of checkboxes but is that possible
to do when using two userforms where the second one is optional? I do not
know if this makes any sense but please help me out if you understand me.
Thanks alot!!

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Checking a userForm that has not been initialized

It would be hard to imagine an instance where you would not know how many
checkboxes are on userform2, but if that is the case:

Sub CodeToBuildcharts()
if Numcheckboxes = 0 then
load Userform2
cnt = 0
for each ctl in Userform2.Controls
if typeof ctl is MSforms.checkbox then
cnt = cnt + 1
end if
next
Numcheckboxes = cnt
end if
Unload Userform2
' now work with numcheckboxes
End sub


--
Regards,
Tom Ogilvy

"Arne Hegefors" wrote:

thanks Tom!! My problem is that the default value for NumCheckBoxes cannot be
a random number but I need the actual number of CheckBoxes. Is that possible
at all? Would really appreciate help! Thanks again for your assistance!

"Tom Ogilvy" skrev:

in a general module

Public NumCharts


in Userform1

Private Sub Userform_Initialize()
NumCharts = 10
End Sub

in Userform 2
code that counts the checkboxes and sets NumCharts.

Somewhere else - code that uses numcharts to create the number of charts.

--
Regards,
Tom Ogilvy


"Arne Hegefors" wrote:

Ok I do not know if this is possible but let me describe the setting. I have
a userform that is shown when the user presses a button on a spreadsheet. the
userform lets the user enter a start date and an end date. these dates refer
to a number of charts that are to be created by my macro. the user can
specify which charts that are to be created be selecting checkboxes, each
chekbox indicates a chart. I used to have all this on the same userform but
it created a problem beacuse the userfom got so big so it was impossible to
use it. Thus i want to change it so that the user specifies the start date
and end date on one userform and then if the user so whishes can press a
button on the first userform that displays the second userform. the second
userform lets the user choose how many charts that are to be selected. the
problem is that this needs to be optional. this means that if the user does
not choose to see the second userform the code must still work i.e. the
program chooses the default setting for the number of charts. I know how to
solve this if you simply choose a number as default. however I need to keep
it variable. my code now counts the number of checkboxes but is that possible
to do when using two userforms where the second one is optional? I do not
know if this makes any sense but please help me out if you understand me.
Thanks alot!!

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 244
Default Checking a userForm that has not been initialized

great thanks Tom! I know that it seems strange but I need to let other people
work around with the program as much as possible and they are not skilled in
programming (neither am I for that matter..). Anyway thanks alot Tom!!!

"Tom Ogilvy" skrev:

It would be hard to imagine an instance where you would not know how many
checkboxes are on userform2, but if that is the case:

Sub CodeToBuildcharts()
if Numcheckboxes = 0 then
load Userform2
cnt = 0
for each ctl in Userform2.Controls
if typeof ctl is MSforms.checkbox then
cnt = cnt + 1
end if
next
Numcheckboxes = cnt
end if
Unload Userform2
' now work with numcheckboxes
End sub


--
Regards,
Tom Ogilvy

"Arne Hegefors" wrote:

thanks Tom!! My problem is that the default value for NumCheckBoxes cannot be
a random number but I need the actual number of CheckBoxes. Is that possible
at all? Would really appreciate help! Thanks again for your assistance!

"Tom Ogilvy" skrev:

in a general module

Public NumCharts


in Userform1

Private Sub Userform_Initialize()
NumCharts = 10
End Sub

in Userform 2
code that counts the checkboxes and sets NumCharts.

Somewhere else - code that uses numcharts to create the number of charts.

--
Regards,
Tom Ogilvy


"Arne Hegefors" wrote:

Ok I do not know if this is possible but let me describe the setting. I have
a userform that is shown when the user presses a button on a spreadsheet. the
userform lets the user enter a start date and an end date. these dates refer
to a number of charts that are to be created by my macro. the user can
specify which charts that are to be created be selecting checkboxes, each
chekbox indicates a chart. I used to have all this on the same userform but
it created a problem beacuse the userfom got so big so it was impossible to
use it. Thus i want to change it so that the user specifies the start date
and end date on one userform and then if the user so whishes can press a
button on the first userform that displays the second userform. the second
userform lets the user choose how many charts that are to be selected. the
problem is that this needs to be optional. this means that if the user does
not choose to see the second userform the code must still work i.e. the
program chooses the default setting for the number of charts. I know how to
solve this if you simply choose a number as default. however I need to keep
it variable. my code now counts the number of checkboxes but is that possible
to do when using two userforms where the second one is optional? I do not
know if this makes any sense but please help me out if you understand me.
Thanks alot!!

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 does Userform get initialized by this? RB Smissaert Excel Programming 4 November 12th 05 05:44 PM
checking input on a textbox in userform to be a % Jean-Pierre D via OfficeKB.com Excel Programming 11 August 25th 05 11:39 PM
Userform runs other subs when initialized zipdog Excel Programming 3 February 2nd 05 04:04 PM
Checking a userform for blanks WillRn Excel Programming 5 November 11th 04 09:40 PM
Excel: VBA userform is shown but not loaded/initialized even though it was first unloaded? Luisa[_2_] Excel Programming 2 December 5th 03 08:15 AM


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