View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
JulieD JulieD is offline
external usenet poster
 
Posts: 618
Default Input date function.

hi Hume
good to see you again
change the code to

Sub createsheets()
Dim s_Date As Date
If MsgBox("Are you very very sure you want to do this?", vbYesNo,
"Create LOTS of Sheets") = vbYes Then
s_Date = InputBox("Enter starting date in the format dd/mm/yy?")
'change the format to what ever is applicable for your region
For i = 1 To Day(DateSerial(Year(s_Date), month(s_Date) + 1, 0))
Sheets("Sheet1").Copy Befo=Worksheets(Worksheets.Count)
ActiveSheet.Name = i
Range("F3").Value = DateSerial(Year(s_Date), _
month(s_Date) + 0, i)
Next
End If
End Sub

--
Cheers
JulieD
check out www.hcts.net.au/tipsandtricks.htm
....well i'm working on it anyway
"hume" wrote in message
...

Hi,
The following code are run and creat many sheets
depand on the how many days of the current month. But
instead of just ONLY creat the current month, I would like
to have an option with the message box to ask me which
month that I like to creat the form. Then it will creat
the sheets according to the input date I provide. How do I
do that?

Sub createsheets()
If MsgBox( "Are you very very sure you want to do
this?", vbYesNo, "Create LOTS of Sheets") = vbYes Then
For i = 1 To Day(DateSerial(Year(Date),Month(Date
+ 1, 0))
Sheets("Sheet1").Copy Befo=Worksheet
(Worksheets.Count)
ActiveSheet.Name = i
Range("F3").Value = DateSerial(Year(Date), _
Month(Date) + 0, i)
Next
End If
End Sub