The code below (finding the last row) had been working fine before, but it started making the
run time error 1004
(3rd line). I've read similar post here, but would like to fix it on this specific code.
With Sheet1.Range("A:A")
If Application.WorksheetFunction.CountA(.Cells) <> 0 Then
' next line is where it errors
Set rng = .SpecialCells(xlCellTypeConstants, 1)
Set rng = rng.Areas(rng.Areas.Count)
lastrow = rng.Cells(rng.Cells.Count).Row
End If
End With