Count the number of rows in another sheet [duplicate]

Your original was not working because the parent of Cells(4, 1) and Cells(4, 1).End(xlDown) was not specified. Prefix any cell address with a period (aka . or full stop) when you are inside a With ... End With block. Example:

With Worksheets("Verbs")
  wordcount = .Range(.Cells(4, 1), .Cells(4, 1).End(xlDown)).Rows.Count
End With

Note the .Cells(4, 1) and not Cells(4, 1). The period specifies that the cell(s) you are referring to are within Worksheets(“Verbs”).

Leave a Comment