I have a worksheet of about 388 items that each item is exported into a template worksheet that is created to itemize each item. It creates the worksheets but I can't get it to stop looping at the line of code in bold comments icons. The line that it stops at is to name the worksheet from the column "A" of the list of 388. I have shorten the list to work on the code. So when I'm done I would have workbook of 388 worksheets from the template made. The template worksheet name is "wbs_template" (hidden). I have attached an example of the workbook.
My other issue is that my IF STATEMENT is skipping lines if I use "1" in it. But if I change it to any other number it creates a wbs item for each item in the worksheet and I can't figure that out either.
Someone please help.
"Sub RenameNewSheet()
Application.Calculation = xlCalculationManual
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Dim MyCell As Range, MyRange As Range, wsSource As Worksheet, i As Integer, MyDate, Lastrow As Integer, Newsht As String
Set MyRange = Worksheets("WBS_Items").Range("tableinfo")
Set MyCell = Worksheets("WBS_Items").Range("WBSNUM")
Set wsSource = Worksheets("WBS_Items")
Lastrow = wsSource.Cells(Rows.Count, 1).End(xlUp).Row
wsSource.Range("A9:Q" & Lastrow).Select
For Each MyCell In MyRange
For i = 1 To Lastrow
Cells(i, 1).Select
If Cells(i, 1).Value <= 1 Then
Worksheets("wbs_template").Visible = True
Sheets("wbs_template").Select
Sheets("wbs_template").Copy before:=Sheets("Rates")
Worksheets("wbs_template").Visible = False
Sheets("wbs_template (2)").Select
Sheets("wbs_template (2)").Name = "Newsht"
Sheets("Newsht").Activate
Range("N8").Value = MyRange.Cells(i, 1) 'Adds WBS Number from column A
Range("E8").Value = Sheets("PROJECT_INFORMATION").Range("A2")
MyDate = Sheets("PROJECT_INFORMATION").Range("G2")
Range("G8").Value = MyDate
Range("I8").Value = Sheets("PROJECT_INFORMATION").Range("D2")
Range("A1").Select
Sheets("Newsht").Name = MyRange.Cells(i, 1) ' renames the new worksheet
ActiveSheet.Calculate
ElseIf Cells(i, 1).Value = "" Then Exit For
End If
Next i
Next MyCell
' HideSheets
RebuildSell
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub