I have a combox that I want to put the values in sheet1 but if I put C30 it will appear many blanks
And it as to be dinamic so the user inputs something and vba find the cells with content and put tehm in the combo list.
If I can understand I adapt to my file
fgarcia90,
Try using the following code in the UserForm_Activate()...
[VBA]Private Sub UserForm_Activate()
Dim i As Integer
'UserForm1.ComboBox1 = Sheet1.Range("C2:C30").Value
For i = 2 To 30
If Sheet1.Cells(i, 3) <> "" Then UserForm1.ComboBox1.AddItem (Sheet1.Cells(i, 3))
Next i
Thanks Ninja.
But do you know how to replace the value of 30, and making vba search the last row in that collum with content to add to the combo?
And another thing... doesn't should appear somewhere in the code the collum "C"?
Is it the ",3"?
I'm new in vba :-)
use sheet1.range("C65536").end(xlup).row instead of 30... so...
[VBA]Private Sub UserForm_Activate()
Dim i As Integer
'UserForm1.ComboBox1 = Sheet1.Range("C2:C30").Value
For i = 2 To Sheet1.Range("C65536").End(xlUp).Row
If Sheet1.Cells(i, 3) <> "" Then UserForm1.ComboBox1.AddItem (Sheet1.Cells(i, 3))
Next i