PC Review


Reply
Thread Tools Rate Thread

Creating new sheet named one week newer that active sheet

 
 
davegb
Guest
Posts: n/a
 
      24th Mar 2008
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.
 
Reply With Quote
 
 
 
 
Otto Moehrbach
Guest
Posts: n/a
 
      24th Mar 2008
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" <(E-Mail Removed)> wrote in message
news:38c007fa-6aaf-4463-8035-(E-Mail Removed)...
>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.



 
Reply With Quote
 
GTVT06
Guest
Posts: n/a
 
      24th Mar 2008
On Mar 24, 3:58*pm, davegb <daveg...@comcast.net> 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
 
Reply With Quote
 
davegb
Guest
Posts: n/a
 
      24th Mar 2008
On Mar 24, 3:13*pm, "Otto Moehrbach" <moehrbachoex...@bellsouth.net>
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" <daveg...@comcast.net> wrote in message
>
> news:38c007fa-6aaf-4463-8035-(E-Mail Removed)...
>
>
>
> >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.
 
Reply With Quote
 
davegb
Guest
Posts: n/a
 
      24th Mar 2008
On Mar 24, 3:32*pm, GTVT06 <gtv...@hotmail.com> wrote:
> On Mar 24, 3:58*pm, davegb <daveg...@comcast.net> 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!
 
Reply With Quote
 
GTVT06
Guest
Posts: n/a
 
      24th Mar 2008
On Mar 24, 4:45*pm, davegb <daveg...@comcast.net> wrote:
> On Mar 24, 3:32*pm, GTVT06 <gtv...@hotmail.com> wrote:
>
>
>
>
>
> > On Mar 24, 3:58*pm, davegb <daveg...@comcast.net> 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
 
Reply With Quote
 
gimme_this_gimme_that@yahoo.com
Guest
Posts: n/a
 
      25th Mar 2008
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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating equivalent named ranges on a new sheet John Microsoft Excel Programming 2 2nd Feb 2009 04:48 AM
Re: Names of named ranges in active sheet only Tom Ogilvy Microsoft Excel Programming 0 8th Dec 2006 03:45 AM
Re: Names of named ranges in active sheet only Norman Jones Microsoft Excel Programming 0 7th Dec 2006 01:45 PM
Copy from active sheet and paste into new sheet using info from cell in active Ingve Microsoft Excel Programming 3 23rd Jan 2006 09:57 PM
Select Named Range - Active sheet - Message Box address al007 Microsoft Excel Programming 3 7th Dec 2005 07:36 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:26 AM.