ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Trouble populating ComboBox from a range (https://www.excelbanter.com/excel-programming/407166-trouble-populating-combobox-range.html)

[email protected]

Trouble populating ComboBox from a range
 
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

Bob Phillips

Trouble populating ComboBox from a range
 
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)



wrote in message
...
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




[email protected]

Trouble populating ComboBox from a range
 
You're a genius. Exactly what I wanted. Thanks

DomThePom

Trouble populating ComboBox from a range
 

Dim cell As Range
For Each cell In Range("CPSBs")
Me.ComboBox1.AddItem cell.Value
Next cell
Set cell = Nothing

" wrote:

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



All times are GMT +1. The time now is 11:14 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com