PC Review


Reply
Thread Tools Rate Thread

Copy Template with Updated Values Each Time

 
 
New Member
Join Date: Aug 2011
Posts: 1
 
      6th Aug 2011
Hi All,

I have a workbook with three main sheets. Two of them are hidden:
  • Start Here
  • Template - hidden
  • Clients - hidden
The goal is to have an employee enter a date in the "Start Here" sheet. Click a button to "Create New Worksheet" based on the hidden sheet "Template." A new "Template2" worksheet opens with the previously entered date from "Start Here" copied and pasted into a cell in the newly created "Template2" sheet.

My code works fine.......until I try to use the "Start Here" sheet again and create another new sheet with a different date. I can get a new "Template3" sheet, but the new date entered in the "Start Here" field copies to the previously created "Template2" sheet. It's as if it's copying the copy and not the original hidden "Template" sheet.

Here is my code:

Sub AddNewSheet()
Worksheets("TEMPLATE").Copy Before:=Worksheets(2)
Worksheets(2).Visible = xlSheetVisible

End Sub

I have also tried this code (works the same as the above code)

Sub CopyTSheet()
'Replace "Template" with the name of the sheet to be copied.
ActiveWorkbook.Sheets("Template").Copy _
After:=ActiveWorkbook.Sheets("Start Here")
ActiveWorkbook.Sheets(2).Visible = xlSheetVisible
End Sub

What am I missing? Can you tell I'm new at this?

I have two additional questions, but would love to solve this problem first.

Question #2: How do I get the newly created "Template" sheet to be the active sheet when created.
Question #3: How can I rename the newly created sheet based on the content of a cell instead of it naming it "Template3" "Template4" "Template5" etc.

Thanks for any help you can give me!

Regards,
Julie
 
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
copy updated table values to a "summary" worksheet goodfish Microsoft Excel Programming 1 23rd Jul 2009 05:54 PM
Is any .net updated required for the new daylight savigns time, or just update the OS is all that is needed? Do DateTime objects need to be updated in .net runtime? Daniel Microsoft C# .NET 2 14th Feb 2007 03:14 PM
Is any .net updated required for the new daylight savigns time, or just update the OS is all that is needed? Do DateTime objects need to be updated in .net runtime? Daniel Microsoft Dot NET 1 13th Feb 2007 02:17 PM
Userform to have Last Updated Values Time & Date Displayed ?? Corey Microsoft Excel Programming 2 14th Dec 2006 03:15 AM
Copy cells values at a particular time and date Geraint Microsoft Excel Misc 3 17th Aug 2003 07:56 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:57 PM.