PC Review


Reply
Thread Tools Rate Thread

Create and name new sheet...

 
 
J.W. Aldridge
Guest
Posts: n/a
 
      9th Jun 2007

I have my criteria and fields set on a worksheet. Once someone pulls
up the sheet (tab) I would like for them to enter a date in cell A1.
Based on the date entered (once it is entered), I would like to (A)
automatically update the name of the current sheet to the month & year
given in A1; (B) create another sheet (copying the entire existing
sheet - except A1) named for the next month.

Example:
if someone enters a date 6/09/2007 in A1.

Macro would:
Rename current sheet June 07
Create a copy of the current sheet.
Name the copy July 07.

Any suggestions?

 
Reply With Quote
 
 
 
 
Don Guillett
Guest
Posts: n/a
 
      9th Jun 2007
Right click sheet tab>view code>insert this.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$1" Then
mc = Target
ActiveSheet.Name = "x"
Sheets(ActiveSheet.Index + 1).Name = "xx"
ActiveSheet.Name = Format(mc, "mmm yy")
x = DateSerial(Year(mc), Month(mc) + 1, 1)
Sheets(ActiveSheet.Index + 1).Name = Format(x, "mmm yy")
End If
End Sub

--
Don Guillett
SalesAid Software
(E-Mail Removed)
"J.W. Aldridge" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>
> I have my criteria and fields set on a worksheet. Once someone pulls
> up the sheet (tab) I would like for them to enter a date in cell A1.
> Based on the date entered (once it is entered), I would like to (A)
> automatically update the name of the current sheet to the month & year
> given in A1; (B) create another sheet (copying the entire existing
> sheet - except A1) named for the next month.
>
> Example:
> if someone enters a date 6/09/2007 in A1.
>
> Macro would:
> Rename current sheet June 07
> Create a copy of the current sheet.
> Name the copy July 07.
>
> Any suggestions?
>


 
Reply With Quote
 
Don Guillett
Guest
Posts: n/a
 
      9th Jun 2007
A RE-read suggests that you may want this in the ThisWorkbook module instead
to do from any sheet.

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
On Error GoTo nogood
If Target.Address = "$A$1" Then
mc = Target
ActiveSheet.Name = "xxxx"
ActiveSheet.Name = Format(mc, "mmm yy")
x = DateSerial(Year(mc), Month(mc) + 1, 1)
Sheets.Add after:=ActiveSheet
ActiveSheet.Name = Format(x, "mmm yy")
End If
Exit Sub
nogood:
MsgBox "have one already"
End Sub


--
Don Guillett
SalesAid Software
(E-Mail Removed)
"J.W. Aldridge" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>
> I have my criteria and fields set on a worksheet. Once someone pulls
> up the sheet (tab) I would like for them to enter a date in cell A1.
> Based on the date entered (once it is entered), I would like to (A)
> automatically update the name of the current sheet to the month & year
> given in A1; (B) create another sheet (copying the entire existing
> sheet - except A1) named for the next month.
>
> Example:
> if someone enters a date 6/09/2007 in A1.
>
> Macro would:
> Rename current sheet June 07
> Create a copy of the current sheet.
> Name the copy July 07.
>
> Any suggestions?
>


 
Reply With Quote
 
J.W. Aldridge
Guest
Posts: n/a
 
      14th Jun 2007
Thanx for the above...

Only one problem...

Would like to copy the current/original sheet.

The sheet generated should be a copy of the original sheet - with A1
blank (but just named for the next month).

Is this possible?

As always, THANX!


 
Reply With Quote
 
Don Guillett
Guest
Posts: n/a
 
      15th Jun 2007
activesheet.copy

--
Don Guillett
SalesAid Software
(E-Mail Removed)
"J.W. Aldridge" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Thanx for the above...
>
> Only one problem...
>
> Would like to copy the current/original sheet.
>
> The sheet generated should be a copy of the original sheet - with A1
> blank (but just named for the next month).
>
> Is this possible?
>
> As always, THANX!
>
>


 
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
Create new sheets based off Data sheet, and template sheet Midget Microsoft Excel Programming 2 1st May 2007 09:55 PM
create a formula in one sheet that would read data from separate sheet automatically QD Microsoft Excel Misc 0 8th Dec 2006 04:17 AM
Pick projects from sheet and create new sheet per project GregR Microsoft Excel Programming 4 6th Feb 2006 05:51 PM
How do I create a command button to jump from sheet to sheet in a. =?Utf-8?B?RGFybGVuZXc=?= Microsoft Excel Worksheet Functions 3 22nd Mar 2005 10:36 PM
How do I create a sheet of Avery file folder labels-sheet size 836 =?Utf-8?B?TWFuaWM2Nw==?= Microsoft Word Document Management 7 19th Mar 2005 08:08 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:03 PM.