Macroless99
New Member
- Joined
- Nov 1, 2014
- Messages
- 3
Hi All
I need some help with VBA code to copy a template tab multiple times and rename each new tab from a list.
* My template tab is called StudentA
* My list is in a tab Data Input cells A4:A50
What I currently have is:
When I run it, it copies the template tab once but doesn't rename and returns a message "400".
Would really appreciate any help you can give me!!!
Kirsty
I need some help with VBA code to copy a template tab multiple times and rename each new tab from a list.
* My template tab is called StudentA
* My list is in a tab Data Input cells A4:A50
What I currently have is:
Code:
[/COLOR]
Sub Copy_Sheets()
Dim i As Integer
Dim wks As Worksheet
Set wks = Sheets("DataInput")
For i = 4 To 50
Sheets("StudentA").Copy After:=Sheets(6)
ActiveSheet.Name = wks.Cells(i, 1)
ActiveSheet.Cells(1, 2) = wks.Cells(i, 1)
Next
End Sub[COLOR=#333333]
When I run it, it copies the template tab once but doesn't rename and returns a message "400".
Would really appreciate any help you can give me!!!
Kirsty