Trouble populating ComboBox from a range

  • Thread starter Thread starter gbirdsong
  • Start date Start date
G

gbirdsong

How do I get this to work?


Private Sub UserForm_Activate()

X = 0
Do While Range("CPSBs").Offset(X, 0).Value <> ""
Me.ComboBox1.AddItem (Range("CPSBs").Offset(X, 0).Value)
X = X + 1
Loop


End Sub

I am not sure how to do this at all.

thanks
 
It is not all too clear but maybe this

Private Sub UserForm_Activate()

For Each cell In Range("CPSBs").Offset(X, 0)
If cell.Value <> "" Then
Me.ComboBox1.AddItem cell.Value
End If
Next cell

End Sub


--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)
 
Dim cell As Range
For Each cell In Range("CPSBs")
Me.ComboBox1.AddItem cell.Value
Next cell
Set cell = Nothing
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top