get values from autofilter options

sipron

New Member
Joined
Aug 6, 2010
Messages
9
Hi
I have two columns. When I autofilter column A I would like to get the values shown in the autofilter in column B.

I don't want to loop through the entire sheet since there are a lot of items and i have to loop them a lot of times.

Does anyone know a solution to this?

Best regards
John
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
Hi John,

Maybe "SpecialCells" will do it.

Something like this:

Code:
Public Sub Test()

Dim oRange As Range

Set oRange = ActiveSheet.Range("B2:B" & ActiveSheet.UsedRange.Rows.Count).SpecialCells(xlCellTypeVisible)

MsgBox oRange.Address

End Sub

Gary
 
Upvote 0
Thank you Gary.
This however will return the entire row of filtered results with a lot of copies. Is it possible to get just one copy of each item?
 
Upvote 0
John,

Maybe the "AdvancedFilter" method is what you need instead of Auto Filters. AdvancedFilter can return unique values. Please see VBA help for that topic.

Can you provide a better description or examples of exactly what you are trying to do?

Gary
 
Upvote 0

Forum statistics

Threads
1,224,574
Messages
6,179,634
Members
452,934
Latest member
Jdsonne31

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top