I'm getting
"1004 application-defined or object-defined error"
I need to count rows containing data beginning at Cell("A2") of multiple worksheets.
I tried several combinations.
How do I put this worksheet("Sheet1") reference into the instruction?
Dim oRows As Long
Dim oRows2 As Long
'...
oRows = WorksheetFunction.CountA(Worksheets("Sheet1").Range("A2", Range("A2").End(xlDown)))
oRows2 = WorksheetFunction.CountA(Worksheets("Sheet2").Range("A2", Range("A2").End(xlDown)))
If there's just data in "A2" the following code returns "1048575" instead of "1".
oRows = ActiveWorkbook.Worksheets("Sheet1").Range("A2", Worksheets("Sheet1").Range("A2").End(xlDown)).Rows.Count
So, I need to use CountA function.