Remove blank rows from combobox

S

Steph

Hi all. I have a userform with comboboxes in it. I populate the combobox
with the following code:

Sub Show_UserForm()
UserForm1.ComboBox1.List = Worksheets("Data Tables").Range("A4:A30").Value
UserForm1.ComboBox2.List = Worksheets("Data Tables").Range("B4:B30").Value
UserForm1.ComboBox3.List = Worksheets("Data Tables").Range("C4:C30").Value
UserForm1.ComboBox4.List = Worksheets("Data Tables").Range("D4:D30").Value
UserForm1.Show
End Sub

The range it is reading from is larger than the number of data entries. I
wanted to allow for the user to add an entry to the combobox pulldown
without having to manipulate code. Can I still allow for this, but at the
same time NOT show 20 blank rows in the combobox pulldown?? Thanks for your
help!
 
S

Steph

Hi guys. Never mind.....I should have known this!!

UserForm1.ComboBox1.List = Worksheets("Data Tables").Range("A4:A" &
Range("A65536").End(xlUp).Row).Value

Thanks anyway!
 

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