ClimoC
Well-known Member
- Joined
- Aug 21, 2009
- Messages
- 584
I'm sure this might just be 2 integers working cleverly in tandem, but I'm not 100% it would work for ANY instance...
Scenario:
Userform with 3 pertinent sections -
A) A 'Starting Date' field (Date)
B) A 'Number of Dates' (Long/Byte)
C) 7 Checkboxes, 1 for each day of the week
If a user selects only "Monday", and says "10 Dates", you could very easily just count through a loop adding 7 to the 'Starting Date'
But we need something that means you could Check "Monday" & "Wednesday", enter "6 dates", and wind up with these in cells:
A1 : 03/01/2011
A2 : 05/01/2011
A3 : 10/01/2011
A4 : 12/01/2011
A5 : 17/01/2011
A6 : 19/01/2011
or if the user selected Monday, Tues, Wed, Thur & Fri, and said 20 dates, you'd get:
A1 : 03/01/2011
A2 : 04/01/2011
A3 : 05/01/2011
A4 : 06/01/2011
A5 : 07/01/2011
A6 : 10/01/2011
A7 : 11/01/2011
A8 : 12/01/2011.... etc
basically, populate as many dates as there are 'dates' to enter, based on the pattern set forth by the checkboxes in the userform?
I'm going to put a handle on the form so that the 'Start Date' HAS to be the 'first checked box running Monday - Sun' so you can't enter the 03/01/2011 (A monday) as the 'start date', if the first checkbox to be true is a Wednesday...
Any advice or a nudge in the right direction would be greatly appreciated!
Thanks
C
Scenario:
Userform with 3 pertinent sections -
A) A 'Starting Date' field (Date)
B) A 'Number of Dates' (Long/Byte)
C) 7 Checkboxes, 1 for each day of the week
If a user selects only "Monday", and says "10 Dates", you could very easily just count through a loop adding 7 to the 'Starting Date'
But we need something that means you could Check "Monday" & "Wednesday", enter "6 dates", and wind up with these in cells:
A1 : 03/01/2011
A2 : 05/01/2011
A3 : 10/01/2011
A4 : 12/01/2011
A5 : 17/01/2011
A6 : 19/01/2011
or if the user selected Monday, Tues, Wed, Thur & Fri, and said 20 dates, you'd get:
A1 : 03/01/2011
A2 : 04/01/2011
A3 : 05/01/2011
A4 : 06/01/2011
A5 : 07/01/2011
A6 : 10/01/2011
A7 : 11/01/2011
A8 : 12/01/2011.... etc
basically, populate as many dates as there are 'dates' to enter, based on the pattern set forth by the checkboxes in the userform?
I'm going to put a handle on the form so that the 'Start Date' HAS to be the 'first checked box running Monday - Sun' so you can't enter the 03/01/2011 (A monday) as the 'start date', if the first checkbox to be true is a Wednesday...
Any advice or a nudge in the right direction would be greatly appreciated!
Thanks
C