Ged Traynor
Board Regular
- Joined
- Oct 12, 2007
- Messages
- 73
Hi All
Just wondering if some could help me with some code. Basically what I'm trying to do is have a sheet called "Dates" with a range that contains a list of dates in it, for example A1:A30
I need VBA Code to look at this date range and copy a sheet called "Template", so if A1 contains 16/06/2011 the code will copy the "Template" sheet and rename it to the value of cell A1 etc
I tried using the below code, which works to a certain extent, but I do get an error on this line Sheets(Sheets.Count).Name = Item
How can I modify the code to copy the "Templates" sheet and rename it as above.
Sub CreateAndNameWorksheets()
Sheets("Dates").Select
Words = Cells.Range("A1:A23")
For Each Item In Words
Sheets.Add After:=Sheets(Sheets.Count)
Sheets(Sheets.Count).Name = Item
Next Item
End Sub
Thanks in Advance
Ged Traynor
Just wondering if some could help me with some code. Basically what I'm trying to do is have a sheet called "Dates" with a range that contains a list of dates in it, for example A1:A30
I need VBA Code to look at this date range and copy a sheet called "Template", so if A1 contains 16/06/2011 the code will copy the "Template" sheet and rename it to the value of cell A1 etc
I tried using the below code, which works to a certain extent, but I do get an error on this line Sheets(Sheets.Count).Name = Item
How can I modify the code to copy the "Templates" sheet and rename it as above.
Sub CreateAndNameWorksheets()
Sheets("Dates").Select
Words = Cells.Range("A1:A23")
For Each Item In Words
Sheets.Add After:=Sheets(Sheets.Count)
Sheets(Sheets.Count).Name = Item
Next Item
End Sub
Thanks in Advance
Ged Traynor