0

Hi am using the below VBA but somehow I am not able to fix the issue. Basically I try to capture Row formula of excel to count the number of row and return that value in a declared variable in VBA

Sub Macro1()

Dim x As Integer
Dim y As Integer
Dim z As Integer
z = WorksheetFunction.row(ClusterQuery)
End Sub

ClusterQuery is NameRange I am using.

braX
  • 11,506
  • 5
  • 20
  • 33
Amit
  • 1
  • `z = Range("ClusterQuery").Rows.Count` – Tim Williams May 15 '20 at 05:58
  • 2
    Note that `.Rows.Count` returns a `Long` not an `Integer`. I recommend to use always `Long` instead of `Integer` as there is [no benefit in using `Integer` in VBA](https://stackoverflow.com/questions/26409117/why-use-integer-instead-of-long/26409520#26409520). – Pᴇʜ May 15 '20 at 06:35

0 Answers0