Ignore Non-Visible Cells From Autofilter?

Jellybean Cowboy

New Member
Joined
May 27, 2004
Messages
10
Hi all,

I hope that someone can help me sort this one out...
Let's say I have lots of "parts" but they could be at three different locations, I've written a macro that is intended to autofilter this list of "parts" depending on the location that I want to look at, and then populate a combo-box with those available data entries.

The code that follows doesn't include the autofilter code - this happens before this subroutine.

'Populates list of parts depending on location
Sub Populate_Parts_List()

Dim cell As Range
Dim TempHeading As String

TempHeading = Sheets("Parts List").Range("D2")
Sheets("Parts List").Range("D2").ClearContents

For Each cell In Sheets("Parts List").Range(Sheets("Parts List").Range("D65536").End(xlUp), Sheets("Parts List").Range("D2").End(xlDown))

If Not IsEmpty(cell) Then Sheets("Parts Tracker").PartsList.AddItem cell

Next cell

Sheets("Parts List").Range("D2") = TempHeading

End Sub

The problem is that even though, on screen, I see only the parts that matched the previous autofilter - the code above populates the PartsList combo-box with the top-most value, the bottom-most value, but indescriminately everything in-between also (the cells that I can't see from the autofilter).

Is there some other way of scanning down this filtered list adding each of the relevant entries to the combo-box as it goes? I thought about adding a command that just moves down to the next cell as if the user had pressed the down arrow on the keyboard but I can't find any commands to allow me to do this.

Please help!
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple

Forum statistics

Threads
1,214,638
Messages
6,120,674
Members
448,977
Latest member
moonlight6

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