yerromnitsuj
09-12-2011, 09:30 AM
I'm trying to decipher a portion of code. The workbook already has a sheet X. When the code gets to this point it creates a new sheet called X and I get an error stating that I can't name a new sheet the same name as an existing sheet. Can someone help me to understand what this code seems to be trying to do and why i might be getting that error? Thanks!
For i = 1 To Worksheets(SheetA).Range("B3").Value
Sheets("X").Select
Sheets("X").Copy After:=Worksheets(Worksheets.Count)
ActiveSheet.Name = Worksheets(SheetB).Cells(i + 1, 1)
For i = 1 To Worksheets(SheetA).Range("B3").Value
Sheets("X").Select
Sheets("X").Copy After:=Worksheets(Worksheets.Count)
ActiveSheet.Name = Worksheets(SheetB).Cells(i + 1, 1)