I created this Macro to add a sum and count after the last row of data. However when the sheet has only one row of data or only a header row I receive an error. I won't know which sheets have data and or multiple rows, so would like something that would work in all instances.
Sheets("Sheet1").Select
Dim NRow As Long
NRow = Range("S2").End(xlDown).Row
Cells(NRow + 1, "S").Formula = "=SUM(S2:S" & LastRow & ")"
Dim ORow As Long
ORow = Range("A2").End(xlDown).Row
Cells(ORow + 1, "A").Formula = "=Count(A2:A" & LastRow & ")"
Any ideas would be appreciated
Bookmarks