Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Simple VBA Code Question (UserForm)

i'm creating a UserForm in VBA and I've run into a little challeng
which at the moment i just don't have an answer to, so i'm turning her
for help. Here's my problem:

I have a combo box with the months January thru Decemeber as possibl
selections, then I have 4 checkboxes for weeks 1 thru 4 of the months
I would like to somehow make it so that if, the current date isn'
passed a particular date certain checkboxes aren't enabled.

As an example, let's say today is January 2 ...so I select January fro
the combo box, but now only the checkbox for Week1 should be enable
since it's only the first week of January. Now if today was January 8
then the checkboxes for Week1 and Week2 should be enabled becuase it'
past Week1 of January and it's Week2.

So basically i'm asking for help on the code to say: the value of th
combo box determines the month, and if it's not past a certain day o
that month then this checkbox shouldn't be enabled.

Thanks in advance for any and all help. I really appreciate it

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Simple VBA Code Question (UserForm)

Something Like

Checkbox1.Value = True
Checkbox2.Value = Day(Date) 7
Checkbox3.Value = Day(Date) 14
Checkbox4.Value = Day(Date) 21

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"abxy " wrote in message
...
i'm creating a UserForm in VBA and I've run into a little challenge
which at the moment i just don't have an answer to, so i'm turning here
for help. Here's my problem:

I have a combo box with the months January thru Decemeber as possible
selections, then I have 4 checkboxes for weeks 1 thru 4 of the months,
I would like to somehow make it so that if, the current date isn't
passed a particular date certain checkboxes aren't enabled.

As an example, let's say today is January 2 ...so I select January from
the combo box, but now only the checkbox for Week1 should be enabled
since it's only the first week of January. Now if today was January 8,
then the checkboxes for Week1 and Week2 should be enabled becuase it's
past Week1 of January and it's Week2.

So basically i'm asking for help on the code to say: the value of the
combo box determines the month, and if it's not past a certain day of
that month then this checkbox shouldn't be enabled.

Thanks in advance for any and all help. I really appreciate it.


---
Message posted from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Simple VBA Code Question (UserForm)

hmm, could you expand on that a little Bob? a little less psued

--
Message posted from http://www.ExcelForum.com

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Simple VBA Code Question (UserForm)

ok, i've just come up with an idea, i'm thinking that maybe i could pu
a little something in like this (for the example's sake let's say tha
the specified date is 2/2/04):

If Combobox1 = "January" And [the date is no
equal to the specified date(2/2/04) or later] Then

Checkbox1.Enabled = False

End if


Ok, now the only problem is, what's the code for "the date is not equa
to the specified date or later" part

Any help

--
Message posted from http://www.ExcelForum.com

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Simple VBA Code Question (UserForm)

Checkbox1.Enabled = (Combobox1.Value = "January" And Date <
DateSerial(2004,02,02))

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"abxy " wrote in message
...
ok, i've just come up with an idea, i'm thinking that maybe i could put
a little something in like this (for the example's sake let's say that
the specified date is 2/2/04):

If Combobox1 = "January" And [the date is not
equal to the specified date(2/2/04) or later] Then

Checkbox1.Enabled = False

End if


Ok, now the only problem is, what's the code for "the date is not equal
to the specified date or later" part

Any help?


---
Message posted from http://www.ExcelForum.com/





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Simple VBA Code Question (UserForm)

This works, thanks Bob Phillips, you always help me out of so many jams
Thanks again, maybe i can return the favor one of these days. And a bi
thanks to everyone else that helped out

--
Message posted from http://www.ExcelForum.com

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Simple VBA Code Question (UserForm)

It's not pseudo, it is working code,. depending upon the date the checkbox
values will be set or not.

Checkbox1 is always set, as we must have a date.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"abxy " wrote in message
...
hmm, could you expand on that a little Bob? a little less psuedo


---
Message posted from http://www.ExcelForum.com/



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
IF formula-simple question; simple operator Rich D Excel Discussion (Misc queries) 4 December 6th 07 03:36 PM
Simple Simple Excel usage question BookerW Excel Discussion (Misc queries) 1 June 23rd 05 10:06 PM
simple question, hopefully a simple answer! Matt B Excel Programming 5 January 13th 04 08:43 PM
Amount of code in UserForm RB Smissaert Excel Programming 7 December 20th 03 07:16 PM
VBA code for Userform Martin Los Excel Programming 4 December 5th 03 03:04 PM


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