Dmitry_D_Onishchenko
New Member
- Joined
- Nov 27, 2019
- Messages
- 18
- Office Version
- 365
- 2013
- 2010
- Platform
- Windows
Hi MrExcel, I need your help.
I have an autofilter applied to a range resulting in non-continuous set of rows visible (see snapshot).
Assume I want to access the number of the first visible non-header row (which is number 7 in this case). When I run
, I get
which exactly matches my expectations in line XXX but does not in line ZZZ: I would expect
What do I miss here? Please advise.
Thanks in advance,
Dmitry
I have an autofilter applied to a range resulting in non-continuous set of rows visible (see snapshot).
Assume I want to access the number of the first visible non-header row (which is number 7 in this case). When I run
VBA Code:
Dim rng As Range
Set rng = Ws.Range("B1:B100").SpecialCells(xlCellTypeVisible)
Debug.Print "XXX: " & rng.Address
Debug.Print "ZZZ: " & rng.Rows(2).row
, I get
Code:
XXX: $B$1,$B$7,$B$11,$B$25:$B$100
ZZZ: 2
which exactly matches my expectations in line XXX but does not in line ZZZ: I would expect
rng.Rows(2)
to return the ordinal row number (i.e., 7 and not 2).What do I miss here? Please advise.
Thanks in advance,
Dmitry