BeanCounters
New Member
- Joined
- Aug 7, 2011
- Messages
- 8
Hi All,
I could really use your help. I need to create a copy of a template, based on data from another worksheet in the workbook. The catch is: Each newly created copy of the "Template" must be able to retain the date from the entry made in the "Start Here" worksheet.
I have a workbook with three main sheets. Two of them are hidden:
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 overrides the date entered in the previously created "Template2" sheet. I need each new copy to retain it's individually entered date.
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 the above 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. Goal is to have it look at the date entered and use it as the sheet name. Ex: Date entered in the "Start Here" sheet is 01/07/2010 and the new sheet name when created will read "Jan 07 2010."
Many thanks to anyone that can give me a hand.
Sincerely,
Julie
I could really use your help. I need to create a copy of a template, based on data from another worksheet in the workbook. The catch is: Each newly created copy of the "Template" must be able to retain the date from the entry made in the "Start Here" worksheet.
I have a workbook with three main sheets. Two of them are hidden:
- Start Here
- Template - hidden
- Clients - hidden
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 overrides the date entered in the previously created "Template2" sheet. I need each new copy to retain it's individually entered date.
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 the above 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. Goal is to have it look at the date entered and use it as the sheet name. Ex: Date entered in the "Start Here" sheet is 01/07/2010 and the new sheet name when created will read "Jan 07 2010."
Many thanks to anyone that can give me a hand.
Sincerely,
Julie