Selecting a Range after Autofilter
I suspect if autofilter is on then you are going to have to use
something like:
Dim rng As Range
Set rng = ActiveSheet.AutoFilter.Range
Regards
J
On 20 Nov, 13:13, "Mike Williams" wrote:
Hello,
I'm very very new to Excel VBA programming and I have a question in
regards to selecting Ranges after an Autofilter has been applied.
The user will filter the sheet down to their criteria and then I need
to loop through columns A and B and add the filtered data to an array.
Here the code I have so far:
Dim LastRow
Dim b()
Range("A65536").End(xlUp).Select
LastRow = ActiveCell.Row
b = Range("A2:B2" & LastRow).SpecialCells(xlCellTypeVisible).value
The problem is that it's not selecting all the values. I'm assuming a
thick gray line between row numbers in an autofilter indicates a
separate range. It only pulls the data from the "first" range. How do I
select all the ranges into one? and assign it to b?
|