Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Month/date problems.


the following code does not give me the current month and
date when it creat the new sheet.
On my C1 cell it has the function of =DATE(YEAR(NOW
()),MONTH(NOW()),1). the new creat sheet on C1 cell start
with 01/01/2005 instead of the current month as
04/01/2005.
Can someone help?

---
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=Worksheets
(Worksheets.Count)
ActiveSheet.Name = i
Range("C1").Value = i
Next
End If
End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Month/date problems.

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=Worksheets _
(Worksheets.Count)
ActiveSheet.Name = i
Range("C1").Value = DateSerial(Year(date), _
Month(Date)+1,i)
Next
End If
End Sub

--
Regards,
Tom Ogilvy


"Hume" wrote in message
...

the following code does not give me the current month and
date when it creat the new sheet.
On my C1 cell it has the function of =DATE(YEAR(NOW
()),MONTH(NOW()),1). the new creat sheet on C1 cell start
with 01/01/2005 instead of the current month as
04/01/2005.
Can someone help?

---
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=Worksheets
(Worksheets.Count)
ActiveSheet.Name = i
Range("C1").Value = i
Next
End If
End Sub



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Month/date problems.


Thanks, But now the month Start at May/01/2005 instead
of April/01/2005.

-----Original Message-----
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=Worksheets _
(Worksheets.Count)
ActiveSheet.Name = i
Range("C1").Value = DateSerial(Year(date), _
Month(Date)+1,i)
Next
End If
End Sub

--
Regards,
Tom Ogilvy


"Hume" wrote in message
...

the following code does not give me the current month

and
date when it creat the new sheet.
On my C1 cell it has the function of =DATE(YEAR(NOW
()),MONTH(NOW()),1). the new creat sheet on C1 cell

start
with 01/01/2005 instead of the current month as
04/01/2005.
Can someone help?

---
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=Worksheets
(Worksheets.Count)
ActiveSheet.Name = i
Range("C1").Value = i
Next
End If
End Sub



.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Month/date problems.

Your code did Month(date) + 1.

In April, that is May. If you want April, remove the + 1. Doing the best I
can with what you provide.

--
Regards,
Tom Ogilvy

"Hummail.come" <sky@hot wrote in message
...

Thanks, But now the month Start at May/01/2005 instead
of April/01/2005.

-----Original Message-----
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=Worksheets _
(Worksheets.Count)
ActiveSheet.Name = i
Range("C1").Value = DateSerial(Year(date), _
Month(Date)+1,i)
Next
End If
End Sub

--
Regards,
Tom Ogilvy


"Hume" wrote in message
...

the following code does not give me the current month

and
date when it creat the new sheet.
On my C1 cell it has the function of =DATE(YEAR(NOW
()),MONTH(NOW()),1). the new creat sheet on C1 cell

start
with 01/01/2005 instead of the current month as
04/01/2005.
Can someone help?

---
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=Worksheets
(Worksheets.Count)
ActiveSheet.Name = i
Range("C1").Value = i
Next
End If
End Sub



.



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
count month when date is in day/month/year format ccKennedy Excel Worksheet Functions 6 April 30th 09 03:32 AM
Match Month in Date With Month in Header [email protected] Excel Worksheet Functions 1 August 17th 07 07:46 PM
Date arithmetic: adding 1 month to prior end of month date manxman Excel Worksheet Functions 2 July 14th 06 09:29 PM
Sort month/date/year data using month and date only SMW820 Excel Discussion (Misc queries) 6 June 22nd 06 05:14 PM
=VLOOKUP(1,Nationality!B5:B29,IF(MONTH(date)6,MONTH(date)-6, MON Ali Excel Worksheet Functions 14 January 18th 06 08:20 AM


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