I need to count the number of rows in a non-contiguous range, such as: “C13, D17:E18, F22, G25, C29:F33”
If I select those cells on my worksheet using Ctrl and the left mouse button, and then run the following code:
The result in the Immediate window is “1”. So that obviously doesn’t work with a non-contiguous range. Is there some other way it can be done?
If I select those cells on my worksheet using Ctrl and the left mouse button, and then run the following code:
Code:
Dim Rng As Range
Set Rng = Selection
Debug.Print Rng.Rows.Count
The result in the Immediate window is “1”. So that obviously doesn’t work with a non-contiguous range. Is there some other way it can be done?
Last edited by a moderator: