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

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.

Forum statistics

Threads
1,215,048
Messages
6,122,862
Members
449,097
Latest member
dbomb1414

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