I have the following code that attempts to count all the column A rows with data in all the worksheets, but it doesn't do that. It looks like it counts the rows in the active worksheet as many times as there are worksheets in the workbook. For instance, if the active worksheet has 5 rows with data in it, and there are 6 worksheets in the book, the count given by the code is 30. Can you help me identify the problem with the code? Thanks.
Dim gtRows As Long
For Each wksht In ThisWorkbook.Sheets
gtRows = gtRows + Application.WorksheetFunction.CountA(Range("A:A"))
MsgBox "The total number of rows used in this workbook is: " & gtRows