copy sheet1 and name sheets using names from a range

D

DL

I want to modify this macro so that it copies sheet1, the appropriate number
of times.
At present it adds new blank sheets.

Sub CopySheet1()
Dim arr As Variant
arr = Range("i1:i44").Value
For i = LBound(arr) To UBound(arr)
Set NewSheet = Sheets.addd
NewSheet.Name = arr(i, 1)
Next i

End Sub
 
J

Jan Karel Pieterse

Hi,

Sub CopySheet1()
Dim arr As Variant
Dim newsheet As Worksheet
arr = Range("i1:i44").Value
For i = LBound(arr) To UBound(arr)
Worksheets("Sheet1").Copy after:=Worksheets("Sheet1")
Set newsheet = ActiveSheet
NewSheet.Name = arr(i, 1)
Next i
End Sub

Regards,

Jan Karel Pieterse
Excel TA/MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top