Luckly, my webpage allow enter calendar date manually by typing instead on clicking a calender widget. It allow both.
I can enter the code in this format -> *.Set "12/01/2013"
Do you have a VB calendar code that can put in a randomized date for a particular month?
Say in my globalsheet I have one of the box that say "January". I like to pass this month into the function and it would give me any date in "January" to .Set into the box.
I try to google it and didnt help much.
Thanks for helping!
This is my crude code for dates that is many many months out:
RndValue = Int( (300-200 +1)* Rnd + 200)
Public Function OutDate()
OD = DateAdd("d", RndValue, Date)
OutDate = OD
Public Function ReturnDate()
RD= DateAdd("d", RndValue+10, Date)
ReturnDate = RD
Is there any stipulation that the date should be a future date??
U need to use a case statement and the following code, I have taken the current date(Today) as an example. U can use the case statement with few checks and work with same code.
This prints the last day of the month
newDate = currDate
'31 can be the maximum date for any month so u can use it
for i=f to 31
newDate = DateAdd("d",1,newDate)
newMonth = DatePart("m", newDate)
If newMonth > h Then
msgbox "maximum date is :: Number of days in the month is :- " & i
'To generate a unique date within the month
Winds of Change