Reputation: 426
Is it not possible to do something simple like this to get the range value of B2?
crdata.Range("B2").SpecialCells(xlCellTypeVisible).Value
I have applied the autofilter to filter out with the given criteria and trying to return the range of B2 as a function.
Upvotes: 0
Views: 20646
Reputation: 1952
Set the .SpecialCells(xlCellTypeVisible)
to a Range, then use Cells(row, column)
on this range to pick out the value that you require. If you are using headers in the result then you may also have to use Offset(1,0)
to address your data. So where 'MySheet' has been defined as a Worksheet object, smething like:
Set rsltRng = MySheet.Autofilter.Range.SpecialCells(xlCellTypeVisible)
msgbox rsltRng.cells(2,2)
Upvotes: 2