Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 72
Default Creating new sheet named one week newer that active sheet

I have a weekly status spreadsheet. Each week, I create a new sheet
with Monday's date on it. Then put in the necessary fields and
formatting. I'm writing a macro to do this (talk about lazy!). If I
have a sheet named "Mar 17", how can I use that to create a sheet
named "Mar 24". I already copied the sheet name into a cell, and XL
recognized it as a date, so I could just copy the name, paste it to a
cell, add 7, then use that as the name for the new sheet. But is there
a more direct way of doing this?
Thanks in advance.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,071
Default Creating new sheet named one week newer that active sheet

Dave
One way:
Sub TestDates()
Dim NewShtName As String
NewShtName = Format(CDate(ActiveSheet.Name) + 7, "mmm dd")
Worksheets.Add(After:=Sheets(Sheets.Count)).Name = NewShtName
End Sub
HTH Otto
"davegb" wrote in message
...
I have a weekly status spreadsheet. Each week, I create a new sheet
with Monday's date on it. Then put in the necessary fields and
formatting. I'm writing a macro to do this (talk about lazy!). If I
have a sheet named "Mar 17", how can I use that to create a sheet
named "Mar 24". I already copied the sheet name into a cell, and XL
recognized it as a date, so I could just copy the name, paste it to a
cell, add 7, then use that as the name for the new sheet. But is there
a more direct way of doing this?
Thanks in advance.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 141
Default Creating new sheet named one week newer that active sheet

On Mar 24, 3:58*pm, davegb wrote:
I have a weekly status spreadsheet. Each week, I create a new sheet
with Monday's date on it. Then put in the necessary fields and
formatting. I'm writing a macro to do this (talk about lazy!). If I
have a sheet named "Mar 17", how can I use that to create a sheet
named "Mar 24". I already copied the sheet name into a cell, and XL
recognized it as a date, so I could just copy the name, paste it to a
cell, add 7, then use that as the name for the new sheet. But is there
a more direct way of doing this?
Thanks in advance.


Run this macro with the sheet activated that you want to add 7 days
to

Sub NewSheet()
Dim i As Variant
Dim idate As Date
idate = ActiveSheet.Name
i = idate + 7
Sheets.Add
ActiveSheet.Name = Format(i, "mmm dd")
End Sub
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 72
Default Creating new sheet named one week newer that active sheet

On Mar 24, 3:13*pm, "Otto Moehrbach"
wrote:
Dave
One way:
Sub TestDates()
* * * Dim NewShtName As String
* * * NewShtName = Format(CDate(ActiveSheet.Name) + 7, "mmm dd")
* * * Worksheets.Add(After:=Sheets(Sheets.Count)).Name = NewShtName
End Sub
HTH *Otto"davegb" wrote in message

...



I have a weekly status spreadsheet. Each week, I create a new sheet
with Monday's date on it. Then put in the necessary fields and
formatting. I'm writing a macro to do this (talk about lazy!). If I
have a sheet named "Mar 17", how can I use that to create a sheet
named "Mar 24". I already copied the sheet name into a cell, and XL
recognized it as a date, so I could just copy the name, paste it to a
cell, add 7, then use that as the name for the new sheet. But is there
a more direct way of doing this?
Thanks in advance.- Hide quoted text -


- Show quoted text -


Thanks, that's exactly the number of ways I needed.
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 72
Default Creating new sheet named one week newer that active sheet

On Mar 24, 3:32*pm, GTVT06 wrote:
On Mar 24, 3:58*pm, davegb wrote:

I have a weekly status spreadsheet. Each week, I create a new sheet
with Monday's date on it. Then put in the necessary fields and
formatting. I'm writing a macro to do this (talk about lazy!). If I
have a sheet named "Mar 17", how can I use that to create a sheet
named "Mar 24". I already copied the sheet name into a cell, and XL
recognized it as a date, so I could just copy the name, paste it to a
cell, add 7, then use that as the name for the new sheet. But is there
a more direct way of doing this?
Thanks in advance.


Run this macro with the sheet activated that you want to add 7 days
to

Sub NewSheet()
Dim i As Variant
Dim idate As Date
idate = ActiveSheet.Name
i = idate + 7
Sheets.Add
ActiveSheet.Name = Format(i, "mmm dd")
End Sub


Thanks, very clever!


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 141
Default Creating new sheet named one week newer that active sheet

On Mar 24, 4:45*pm, davegb wrote:
On Mar 24, 3:32*pm, GTVT06 wrote:





On Mar 24, 3:58*pm, davegb wrote:


I have a weekly status spreadsheet. Each week, I create a new sheet
with Monday's date on it. Then put in the necessary fields and
formatting. I'm writing a macro to do this (talk about lazy!). If I
have a sheet named "Mar 17", how can I use that to create a sheet
named "Mar 24". I already copied the sheet name into a cell, and XL
recognized it as a date, so I could just copy the name, paste it to a
cell, add 7, then use that as the name for the new sheet. But is there
a more direct way of doing this?
Thanks in advance.


Run this macro with the sheet activated that you want to add 7 days
to


Sub NewSheet()
Dim i As Variant
Dim idate As Date
idate = ActiveSheet.Name
i = idate + 7
Sheets.Add
ActiveSheet.Name = Format(i, "mmm dd")
End Sub


Thanks, very clever!- Hide quoted text -

- Show quoted text -


your welcome
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 236
Default Creating new sheet named one week newer that active sheet

I recommand yyyymmdd format. That way the order of the files is sorted
by date when you read the XL files from a folder using Explorer.
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
Names of named ranges in active sheet only Tom Ogilvy Excel Programming 0 December 8th 06 03:45 AM
Names of named ranges in active sheet only Norman Jones Excel Programming 0 December 7th 06 01:45 PM
Creating a Dynamic Named Range Using Sheet Name and Column Header burl_rfc_h Excel Programming 8 February 13th 06 10:53 PM
Copy from active sheet and paste into new sheet using info from cell in active Ingve Excel Programming 3 January 23rd 06 09:57 PM
Creating absolute references including active sheet name in the formula Maria J-son Excel Programming 4 May 10th 05 08:41 AM


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