I found this VBA code that does exactly what i want, but it keeps deleting my headings on the summary sheet. My question is, is the highlighted code line necessary and if it is what purpose does it serve?
Sub UpdateSummary()
Dim Ws As Worksheet, LstRw As Long
LstRw = Sheets("Summary").Cells(Rows.Count, "A").End(xlUp).Row
With Sheets("Summary")
.Range("A2:B" & LstRw).ClearContents
NxtRw = 2
For Each Ws In ThisWorkbook.Worksheets
If Not Ws.Name = "Template" And Not Ws.Name = "Summary" Then
.Cells(NxtRw, "A").Value = Ws.Range("A2")
.Cells(NxtRw, "B").Value = Ws.Range("B2")
NxtRw = NxtRw + 1
End If
Next Ws
End With
End Sub
Sub UpdateSummary()
Dim Ws As Worksheet, LstRw As Long
LstRw = Sheets("Summary").Cells(Rows.Count, "A").End(xlUp).Row
With Sheets("Summary")
.Range("A2:B" & LstRw).ClearContents
NxtRw = 2
For Each Ws In ThisWorkbook.Worksheets
If Not Ws.Name = "Template" And Not Ws.Name = "Summary" Then
.Cells(NxtRw, "A").Value = Ws.Range("A2")
.Cells(NxtRw, "B").Value = Ws.Range("B2")
NxtRw = NxtRw + 1
End If
Next Ws
End With
End Sub