Hello everyone. I've been using previous posts here for some time now to help in my daily VBA problems. Now I have one of my own, and any help would be terrific.
I have a combo box that I would like add items too from an autofiltered worksheet. I understand this means I can't use .RowSource. At the same time, the workbook will be shared so I can't use AdvancedFilter as well. Is there a way to search for only visible items on an autofiltered worksheet and add them to the combobox?
Here is my current code, though it doesn't seem to work:
Dim cell As Range, Thisrow As Long, Lastrow As Long
Dim strRowSource As String
strRowSource = Sheet1.Range("A1", Sheet1.Range("A65536").End(xlUp)).Address
With UserForm.combobox1
For Each cell In Range(strRowSource)
Thisrow = cell.Row
If Not cell.Rows.Hidden And Thisrow <> Lastrow Then
.AddItem cell.value
End If
Lastrow = Thisrow
Next cell
End With
Bookmarks