Hello,
I have a script that makes multiple copies of a template and pastes subtotals to a summary sheet (NSN Summary) from those new worksheets. I need a way to AUTOSUM those subtotals on the NSN Summary sheet. I am thinking it would be a separate macro using ActiveCell.Offset but don't know how. Thanks.
Sub CopyTemplates()
Dim LR As Long
Dim i As Long
Application.ScreenUpdating = False
Worksheets("Template").Visible = True
Call AutoNum
With Worksheets("Fill This Out First")
LR = .Range("A" & 5).End(xlDown).Row
For i = 5 To LR
If Not Evaluate("isref(" & .Range("A" & i).Value & "!A1)") Then
Worksheets("Template").Copy After:=Sheets(Sheets.Count)
ActiveSheet.Name = .Range("A" & i).Value
Range("D1:D2").Value = Range("D1:D2").Value
Range("D5").Value = .Cells(i, "B").Value
Range("H3").Value = "CLIN " & Format(.Cells(i, "C").Value, "0000")
Worksheets("NSN Summary").Cells(i + 24, "B").Value = Range("H3").Value
Worksheets("NSN Summary").Cells(i + 24, "C").Formula = "=" & Range("H40").Address(External:=True)
'This is where I need the AUTOSUM for each subtotal ("H40")
End If
Next i
End With
Worksheets("Template").Visible = xlSheetHidden
Application.ScreenUpdating = True
End Sub
Bookmarks