Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 271
Default Need help with 52 worksheets that need dates entered

I have a date on the first sheet of 8/8/09 and i need to change the dates for
each additonal worksheet by adding 7 days, 8/15/09 on the 2nd, 8/22/09 on the
3rd etc.

Is there a macro i can use so i dont have to change all 52 worksheets just
the first one and it will change that cell in each additional sheet?
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,501
Default Need help with 52 worksheets that need dates entered

Hi,

Right click the tab on your first sheet, view code and paste this in
Entering a date in A1 will change the date in all other sheets


Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count 1 Or IsEmpty(Target) Then Exit Sub
If Target.Address = "$A$1" Then
If IsDate(Target) Then
On Error Resume Next
Application.EnableEvents = False
Mydate = Target.Value
For x = 2 To 51
Mydate = Mydate + 7
Sheets(x).Range("A1") = Mydate
Next
Application.EnableEvents = True
On Error GoTo 0
End If
End If
End Sub


Mike


"Susan" wrote:

I have a date on the first sheet of 8/8/09 and i need to change the dates for
each additonal worksheet by adding 7 days, 8/15/09 on the 2nd, 8/22/09 on the
3rd etc.

Is there a macro i can use so i dont have to change all 52 worksheets just
the first one and it will change that cell in each additional sheet?

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 271
Default Need help with 52 worksheets that need dates entered

Thank you so much, worked perfectly!!

"Mike H" wrote:

Hi,

Right click the tab on your first sheet, view code and paste this in
Entering a date in A1 will change the date in all other sheets


Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count 1 Or IsEmpty(Target) Then Exit Sub
If Target.Address = "$A$1" Then
If IsDate(Target) Then
On Error Resume Next
Application.EnableEvents = False
Mydate = Target.Value
For x = 2 To 51
Mydate = Mydate + 7
Sheets(x).Range("A1") = Mydate
Next
Application.EnableEvents = True
On Error GoTo 0
End If
End If
End Sub


Mike


"Susan" wrote:

I have a date on the first sheet of 8/8/09 and i need to change the dates for
each additonal worksheet by adding 7 days, 8/15/09 on the 2nd, 8/22/09 on the
3rd etc.

Is there a macro i can use so i dont have to change all 52 worksheets just
the first one and it will change that cell in each additional sheet?

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
Dates-Automatically entered in cells Taryn Excel Discussion (Misc queries) 8 January 31st 09 10:23 AM
Dates not entered correctly Stealth_scorpio Excel Discussion (Misc queries) 6 October 13th 08 02:32 PM
Dates entered for document returnx Thom Excel Discussion (Misc queries) 1 January 28th 07 03:26 PM
Validating Dates Entered patam Excel Discussion (Misc queries) 2 September 2nd 05 05:36 PM
If both dates are entered into a cell then answer is yes Teresa Warne Excel Worksheet Functions 2 October 30th 04 02:56 PM


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