Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
John
 
Posts: n/a
Default Serial Date in Multiple Worksheet

Hi, I need to create a workbook with the same Multiple Worksheet (TAB) form
on it. This form will be used for each day of the month. The problem is I
want to be able to enter the date on the first TAB and has the date replica
to each worksheet add 1 day to each sheet.

Example:

The first sheet - Monday, December 26, 2005; the second - Tuesday, December
27, 2005; the third - Wednesday, December 28, 2005; and so on.

Thanks in advanced.

  #2   Report Post  
Posted to microsoft.public.excel.misc
Max
 
Posts: n/a
Default Serial Date in Multiple Worksheet

Try running the sub below (Sub is by Dave Peterson, and was plucked from a
post by Gord Dibben in .newusers)

Here's how to set it up ..

In a new book,
Name 2 empty sheets as: List, Template

In List, enter in A1 the first date, say: 26-Dec-2005
Copy A1 down to say, A10, to fill the range till 04-Jan-2006

In Template, we could prepare a sample "template" table with col headers,
sample data, format to taste, etc (or just leave the sheet blank for now)

The sub will copy the sheet named as: Template
and create & name the new sheets
according to the list in col A in List

Steps
--------
Press Alt+F11 to go to VBE
Click Insert Module
Copy paste everything within the dotted lines below
into the code window (whitespace) on the right

'-------begin vba-----
Sub CreateNameSheets()
' by Dave Peterson
' (slightly revised by Max to format sheetnames <g)
' List sheetnames required in col A in a sheet: List
' Sub will copy sheets based on the sheet named as: Template
' and name the sheets accordingly

Dim TemplateWks As Worksheet
Dim ListWks As Worksheet
Dim ListRng As Range
Dim myCell As Range

Set TemplateWks = Worksheets("Template")
Set ListWks = Worksheets("list")
With ListWks
Set ListRng = .Range("a1", .Cells(.Rows.Count, "A").End(xlUp))
End With

For Each myCell In ListRng.Cells
TemplateWks.Copy After:=Worksheets(Worksheets.Count)
On Error Resume Next
ActiveSheet.Name = Format(myCell.Value, "dddd, mmmm dd, yyyy")
If Err.Number < 0 Then
MsgBox "Please fix: " & ActiveSheet.Name
Err.Clear
End If
On Error GoTo 0
Next myCell

End Sub
'-------endvba------

Press Alt+Q to get back to Excel

In Excel, press Alt+F8 (brings up the Macro dialog)
Select "CreateNameSheets" click "Run"
(or just double-click directly on "CreateNameSheets")

The sub will create 10 new sheets to the right,
naming these as desired:
Monday, December 26, 2005
Tuesday, December 27, 2005
....
Wednesday, January 04, 2006

--
Rgds
Max
xl 97
---
Singapore, GMT+8
xdemechanik
http://savefile.com/projects/236895
--
"John" wrote in message
...
Hi, I need to create a workbook with the same Multiple Worksheet (TAB)

form
on it. This form will be used for each day of the month. The problem is I
want to be able to enter the date on the first TAB and has the date

replica
to each worksheet add 1 day to each sheet.

Example:

The first sheet - Monday, December 26, 2005; the second - Tuesday,

December
27, 2005; the third - Wednesday, December 28, 2005; and so on.

Thanks in advanced.



  #3   Report Post  
Posted to microsoft.public.excel.misc
John
 
Posts: n/a
Default Serial Date in Multiple Worksheet

Thanks for the quick response. I really like that scrip, but I guest I wasn't
clear enough.

What I want to do is in a "cell" auto fill the date in each sheet.

Example: sheet1 - cell A4 - Monday, December 26, 2005; sheet2 - cell A4 -
Tuesday, December 27, 2005; sheet3 - cell A4 - Wednesday, December 28, 2005

Each sheet will be exactly the same but the date will change. The TAB name
mean nothing.

Thanks

"Max" wrote:

Try running the sub below (Sub is by Dave Peterson, and was plucked from a
post by Gord Dibben in .newusers)

Here's how to set it up ..

In a new book,
Name 2 empty sheets as: List, Template

In List, enter in A1 the first date, say: 26-Dec-2005
Copy A1 down to say, A10, to fill the range till 04-Jan-2006

In Template, we could prepare a sample "template" table with col headers,
sample data, format to taste, etc (or just leave the sheet blank for now)

The sub will copy the sheet named as: Template
and create & name the new sheets
according to the list in col A in List

Steps
--------
Press Alt+F11 to go to VBE
Click Insert Module
Copy paste everything within the dotted lines below
into the code window (whitespace) on the right

'-------begin vba-----
Sub CreateNameSheets()
' by Dave Peterson
' (slightly revised by Max to format sheetnames <g)
' List sheetnames required in col A in a sheet: List
' Sub will copy sheets based on the sheet named as: Template
' and name the sheets accordingly

Dim TemplateWks As Worksheet
Dim ListWks As Worksheet
Dim ListRng As Range
Dim myCell As Range

Set TemplateWks = Worksheets("Template")
Set ListWks = Worksheets("list")
With ListWks
Set ListRng = .Range("a1", .Cells(.Rows.Count, "A").End(xlUp))
End With

For Each myCell In ListRng.Cells
TemplateWks.Copy After:=Worksheets(Worksheets.Count)
On Error Resume Next
ActiveSheet.Name = Format(myCell.Value, "dddd, mmmm dd, yyyy")
If Err.Number < 0 Then
MsgBox "Please fix: " & ActiveSheet.Name
Err.Clear
End If
On Error GoTo 0
Next myCell

End Sub
'-------endvba------

Press Alt+Q to get back to Excel

In Excel, press Alt+F8 (brings up the Macro dialog)
Select "CreateNameSheets" click "Run"
(or just double-click directly on "CreateNameSheets")

The sub will create 10 new sheets to the right,
naming these as desired:
Monday, December 26, 2005
Tuesday, December 27, 2005
....
Wednesday, January 04, 2006

--
Rgds
Max
xl 97
---
Singapore, GMT+8
xdemechanik
http://savefile.com/projects/236895
--
"John" wrote in message
...
Hi, I need to create a workbook with the same Multiple Worksheet (TAB)

form
on it. This form will be used for each day of the month. The problem is I
want to be able to enter the date on the first TAB and has the date

replica
to each worksheet add 1 day to each sheet.

Example:

The first sheet - Monday, December 26, 2005; the second - Tuesday,

December
27, 2005; the third - Wednesday, December 28, 2005; and so on.

Thanks in advanced.




  #4   Report Post  
Posted to microsoft.public.excel.misc
Max
 
Posts: n/a
Default Serial Date in Multiple Worksheet

Sorry for the mis-interp, John !
I don't have further ideas to offer here

Do hang around awhile for insights from others
--
Rgds
Max
xl 97
---
Singapore, GMT+8
xdemechanik
http://savefile.com/projects/236895
--


  #5   Report Post  
Posted to microsoft.public.excel.misc
John
 
Posts: n/a
Default Serial Date in Multiple Worksheet

Thanks, I will :)

"Max" wrote:

Sorry for the mis-interp, John !
I don't have further ideas to offer here

Do hang around awhile for insights from others
--
Rgds
Max
xl 97
---
Singapore, GMT+8
xdemechanik
http://savefile.com/projects/236895
--





  #6   Report Post  
Posted to microsoft.public.excel.misc
Gord Dibben
 
Posts: n/a
Default Serial Date in Multiple Worksheet

John

Sub Date_Increment()
''increment a date in A4 across sheets
Dim myDate As Date
Dim iCtr As Long
myDate = DateSerial(2005, 12, 27)
For iCtr = 1 To Worksheets.Count
With Worksheets(iCtr).Range("A4")
.Value = myDate - 1 + iCtr
.NumberFormat = "mm/dd/yyyy"
End With
Next iCtr
End Sub


Gord Dibben Excel MVP

On Mon, 26 Dec 2005 23:05:02 -0800, "John"
wrote:

Thanks, I will :)

"Max" wrote:

Sorry for the mis-interp, John !
I don't have further ideas to offer here

Do hang around awhile for insights from others
--
Rgds
Max
xl 97
---
Singapore, GMT+8
xdemechanik
http://savefile.com/projects/236895
--



  #7   Report Post  
Posted to microsoft.public.excel.misc
John
 
Posts: n/a
Default Serial Date in Multiple Worksheet

Thanks for the script. But how do I use it?

"Gord Dibben" wrote:

John

Sub Date_Increment()
''increment a date in A4 across sheets
Dim myDate As Date
Dim iCtr As Long
myDate = DateSerial(2005, 12, 27)
For iCtr = 1 To Worksheets.Count
With Worksheets(iCtr).Range("A4")
.Value = myDate - 1 + iCtr
.NumberFormat = "mm/dd/yyyy"
End With
Next iCtr
End Sub


Gord Dibben Excel MVP

On Mon, 26 Dec 2005 23:05:02 -0800, "John"
wrote:

Thanks, I will :)

"Max" wrote:

Sorry for the mis-interp, John !
I don't have further ideas to offer here

Do hang around awhile for insights from others
--
Rgds
Max
xl 97
---
Singapore, GMT+8
xdemechanik
http://savefile.com/projects/236895
--




  #8   Report Post  
Posted to microsoft.public.excel.misc
John
 
Posts: n/a
Default Serial Date in Multiple Worksheet

Thanks I figure it out.

"John" wrote:

Thanks for the script. But how do I use it?

"Gord Dibben" wrote:

John

Sub Date_Increment()
''increment a date in A4 across sheets
Dim myDate As Date
Dim iCtr As Long
myDate = DateSerial(2005, 12, 27)
For iCtr = 1 To Worksheets.Count
With Worksheets(iCtr).Range("A4")
.Value = myDate - 1 + iCtr
.NumberFormat = "mm/dd/yyyy"
End With
Next iCtr
End Sub


Gord Dibben Excel MVP

On Mon, 26 Dec 2005 23:05:02 -0800, "John"
wrote:

Thanks, I will :)

"Max" wrote:

Sorry for the mis-interp, John !
I don't have further ideas to offer here

Do hang around awhile for insights from others
--
Rgds
Max
xl 97
---
Singapore, GMT+8
xdemechanik
http://savefile.com/projects/236895
--




  #9   Report Post  
Posted to microsoft.public.excel.misc
John
 
Posts: n/a
Default Serial Date in Multiple Worksheet

Hi, the script works great. I do have one problem.

The line "myDate = DateSerial(2005, 12, 27)". The way the script is written
I would need to edit the script to get the correct dates.

What I am hoping to do is enter the date from the cell in the first
worksheet and then run the macro replic to the other sheets.

Thanks

"Gord Dibben" wrote:

John

Sub Date_Increment()
''increment a date in A4 across sheets
Dim myDate As Date
Dim iCtr As Long
myDate = DateSerial(2005, 12, 27)
For iCtr = 1 To Worksheets.Count
With Worksheets(iCtr).Range("A4")
.Value = myDate - 1 + iCtr
.NumberFormat = "mm/dd/yyyy"
End With
Next iCtr
End Sub


Gord Dibben Excel MVP

On Mon, 26 Dec 2005 23:05:02 -0800, "John"
wrote:

Thanks, I will :)

"Max" wrote:

Sorry for the mis-interp, John !
I don't have further ideas to offer here

Do hang around awhile for insights from others
--
Rgds
Max
xl 97
---
Singapore, GMT+8
xdemechanik
http://savefile.com/projects/236895
--




  #10   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default Serial Date in Multiple Worksheet

You can change this line to point at the cell you want:
From:
myDate = DateSerial(2005, 12, 27)
to:
myDate = worksheets("sheet99").range("a1").value

Change the sheet name and the cell address to what you need.


John wrote:

Hi, the script works great. I do have one problem.

The line "myDate = DateSerial(2005, 12, 27)". The way the script is written
I would need to edit the script to get the correct dates.

What I am hoping to do is enter the date from the cell in the first
worksheet and then run the macro replic to the other sheets.

Thanks

"Gord Dibben" wrote:

John

Sub Date_Increment()
''increment a date in A4 across sheets
Dim myDate As Date
Dim iCtr As Long
myDate = DateSerial(2005, 12, 27)
For iCtr = 1 To Worksheets.Count
With Worksheets(iCtr).Range("A4")
.Value = myDate - 1 + iCtr
.NumberFormat = "mm/dd/yyyy"
End With
Next iCtr
End Sub


Gord Dibben Excel MVP

On Mon, 26 Dec 2005 23:05:02 -0800, "John"
wrote:

Thanks, I will :)

"Max" wrote:

Sorry for the mis-interp, John !
I don't have further ideas to offer here

Do hang around awhile for insights from others
--
Rgds
Max
xl 97
---
Singapore, GMT+8
xdemechanik
http://savefile.com/projects/236895
--





--

Dave Peterson


  #11   Report Post  
Posted to microsoft.public.excel.misc
John
 
Posts: n/a
Default Serial Date in Multiple Worksheet

Thanks, it all works fine now.

"Dave Peterson" wrote:

You can change this line to point at the cell you want:
From:
myDate = DateSerial(2005, 12, 27)
to:
myDate = worksheets("sheet99").range("a1").value

Change the sheet name and the cell address to what you need.


John wrote:

Hi, the script works great. I do have one problem.

The line "myDate = DateSerial(2005, 12, 27)". The way the script is written
I would need to edit the script to get the correct dates.

What I am hoping to do is enter the date from the cell in the first
worksheet and then run the macro replic to the other sheets.

Thanks

"Gord Dibben" wrote:

John

Sub Date_Increment()
''increment a date in A4 across sheets
Dim myDate As Date
Dim iCtr As Long
myDate = DateSerial(2005, 12, 27)
For iCtr = 1 To Worksheets.Count
With Worksheets(iCtr).Range("A4")
.Value = myDate - 1 + iCtr
.NumberFormat = "mm/dd/yyyy"
End With
Next iCtr
End Sub


Gord Dibben Excel MVP

On Mon, 26 Dec 2005 23:05:02 -0800, "John"
wrote:

Thanks, I will :)

"Max" wrote:

Sorry for the mis-interp, John !
I don't have further ideas to offer here

Do hang around awhile for insights from others
--
Rgds
Max
xl 97
---
Singapore, GMT+8
xdemechanik
http://savefile.com/projects/236895
--





--

Dave Peterson

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
Excel 2000 worksheet where I want to convert date format Russell-stanely Excel Discussion (Misc queries) 5 December 19th 05 03:02 AM
Update a formula based on date worksheet was saved Kevin McQuain Excel Worksheet Functions 0 October 6th 05 03:06 PM
how do i maintain one worksheet from data from multiple worksheet Nensie Michel Excel Worksheet Functions 1 August 12th 05 07:32 PM
Linking multiple data into one worksheet. Patrick White Excel Worksheet Functions 0 June 28th 05 11:27 AM
Use Julian Date To Create Serial Number antho10359 Excel Discussion (Misc queries) 4 December 9th 04 02:50 AM


All times are GMT +1. The time now is 04:29 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"