Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Update and Add


I have a worksheet in excel that I would like to have automatically add
a copy of itself to the workbook on Mondays or every 7 days from a
specified date.

I also want this sheet to automatically add the the dates of the week
to cells 'g8', 'k8','o8','s8','w8'. So that if Mon is 05-05-05 then it
will show in cell g8 and Tuesday would show 05-06-05 and so on.

Is this possible and if so what would the code be.


--
oberon.black
------------------------------------------------------------------------
oberon.black's Profile: http://www.excelforum.com/member.php...o&userid=26732
View this thread: http://www.excelforum.com/showthread...hreadid=439578

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default Update and Add

One way (put in the ThisWorkbook code module):

Private Sub Workbook_Open()
Dim dNewDate As Date
With Worksheets
With .Item(.Count).Range("G8")
If IsDate(.Value) Then _
If Date - .Value < 7 Then Exit Sub
dNewDate = .Value + 7
End With
With .Add(After:=.Item(.Count)).Range("G8")
.Value = dNewDate
.NumberFormat = "mm-dd-yy"
.Resize(1, 4).AutoFill _
Destination:=.Resize(1, 17), _
Type:=xlFillDefault
End With
End With
End Sub




In article ,
oberon.black
wrote:

I have a worksheet in excel that I would like to have automatically add
a copy of itself to the workbook on Mondays or every 7 days from a
specified date.

I also want this sheet to automatically add the the dates of the week
to cells 'g8', 'k8','o8','s8','w8'. So that if Mon is 05-05-05 then it
will show in cell g8 and Tuesday would show 05-06-05 and so on.

Is this possible and if so what would the code be.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default Update and Add

My previous post added a new sheet. To copy the last sheet in the
workbook:


Private Sub Workbook_Open()
Dim dNewDate As Date
With Worksheets
With .Item(.Count)
With .Range("G8")
If IsDate(.Value) Then _
If Date - .Value < 7 Then Exit Sub
dNewDate = .Value + 7
End With
.Copy After:=Sheets(Sheets.Count)
With ActiveSheet.Range("G8")
.Value = dNewDate
.NumberFormat = "mm-dd-yy"
.Resize(1, 4).AutoFill _
Destination:=.Resize(1, 17), _
Type:=xlFillDefault
End With
End With
End With
End Sub




In article ,
JE McGimpsey wrote:

One way (put in the ThisWorkbook code module):

<snip

In article ,
oberon.black
wrote:

I have a worksheet in excel that I would like to have automatically add
a copy of itself to the workbook on Mondays or every 7 days from a
specified date.

I also want this sheet to automatically add the the dates of the week
to cells 'g8', 'k8','o8','s8','w8'. So that if Mon is 05-05-05 then it
will show in cell g8 and Tuesday would show 05-06-05 and so on.

Is this possible and if so what would the code be.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Update and Add


where is the 'this workbook code module'

--
oberon.blac
-----------------------------------------------------------------------
oberon.black's Profile: http://www.excelforum.com/member.php...fo&userid=2673
View this thread: http://www.excelforum.com/showthread.php?threadid=43957

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Update and Add


I don't need this code to run on all the worksheets in my workbook. I
only need it for one worksheet.

Plus when I put the code in nothing happened.

Please advise.


--
oberon.black
------------------------------------------------------------------------
oberon.black's Profile: http://www.excelforum.com/member.php...o&userid=26732
View this thread: http://www.excelforum.com/showthread...hreadid=439578



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default Update and Add

The code doesn't run on all worksheets. It checks the last worksheet to
see if the date in G8 is within 7 days. If so, it exits, if not, it
copies that sheet and puts the new date in the new sheet's G8.

Where did you "put the code in"? If you put it in the ThisWorkbook code
module, the event macro fires each time the workbook is opened.

In article ,
oberon.black
wrote:

I don't need this code to run on all the worksheets in my workbook. I
only need it for one worksheet.

Plus when I put the code in nothing happened.

Please advise.

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default Update and Add

See

http://www.mcgimpsey.com/excel/modules.html

In article ,
oberon.black
wrote:

where is the 'this workbook code module'?

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
Update one worksheet tab to automatically update all other tabs? shoechic1 Excel Worksheet Functions 1 May 24th 09 03:55 PM
Data Validation lists update orginal cell with list update [email protected] Excel Worksheet Functions 3 July 11th 08 07:56 AM
i want to update one excel file the other one update automaticaly Basant New Users to Excel 1 December 16th 06 12:50 AM
Excel 2003 - Update or Don't Update Links Problem Jamie Excel Programming 4 July 7th 05 02:08 PM
how to update data on sheet1 and have it auto update on sheet2 Tommy Excel Programming 6 May 11th 05 06:41 PM


All times are GMT +1. The time now is 02:55 PM.

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"