E
Ed
Good evening,
I use a filter to display selected subsets of rows in a large sreadsheet:
Dim r1 As Range
With xlSheet.Rows
.AutoFilter field:=1, Criteria1:=State
.AutoFilter field:=2, Criteria1:=Evt
Set r1 = .SpecialCells(xlCellTypeVisible)
End With
The spreadsheet shows exactly what I want, but r1 turns out to be a
multi-area range rather than a simple, single area rectabgle.
I'd love to be able to reference cells in r1 with something simple like:
r1.cells(1,2) or r1.cells(5,3)
but, that returns cells from the worksheet that are hidden, sort of "in
between" r1 areas. Items(n,m) doesn't work either. I've tried variations
other than specialcells, too.
Is there a simple way to reference r1 cells by row and column as they appear
on the screen?
I realize that I can loop through the areas, rows, and columns and build my
own 2D matrix, but I suspect there's an easy way to do this that I just
haven't uncovered.
Thanks in advance
Ed
I use a filter to display selected subsets of rows in a large sreadsheet:
Dim r1 As Range
With xlSheet.Rows
.AutoFilter field:=1, Criteria1:=State
.AutoFilter field:=2, Criteria1:=Evt
Set r1 = .SpecialCells(xlCellTypeVisible)
End With
The spreadsheet shows exactly what I want, but r1 turns out to be a
multi-area range rather than a simple, single area rectabgle.
I'd love to be able to reference cells in r1 with something simple like:
r1.cells(1,2) or r1.cells(5,3)
but, that returns cells from the worksheet that are hidden, sort of "in
between" r1 areas. Items(n,m) doesn't work either. I've tried variations
other than specialcells, too.
Is there a simple way to reference r1 cells by row and column as they appear
on the screen?
I realize that I can loop through the areas, rows, and columns and build my
own 2D matrix, but I suspect there's an easy way to do this that I just
haven't uncovered.
Thanks in advance
Ed