Range for combobox with IF

K

KUMPFfrog

I have a user form with a combobox. I don't know much about writing code,
but i would like the ref list (range) to prettymuch be col B starting at row
7 - however i don't want everything in that col. I just want everything with
a number, no blanks or text.
 
J

JLGWhiz

This has not been tested, but should be OK. If not, post back with any error
messages received. Open the VB editor, right click on the userform name and
click view code in the pop up menu. Paste the code below into the code
window for the form. When you use the UserForm1.Show in the standard code
module1, it should load your combo box.

Private Sub UserForm_Initialize()
Dim lr As Long, i As Long
lr = ActiveSheet.Cells(Rows.Count, 2).End(xlUp).Row
With ActiveSheet
For i = 7 To lr
If .Cells(i, 2) <> "" And IsNumeric(.Cells(i, 2)) Then
Me.ComboBox1.AddItem .Cells(i, 2)
End If
Next
End With
End Sub
 
K

KUMPFfrog

JLGWhiz
i was hoping you could help me again. this time i want to populate a
combobox based on this criteria:
column "n" only if coresponding value in column "s" matches textbox.value
 

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

Top