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.
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!
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!