help with adding list box to userform

C

Chris

I have this code when the userform loads:

Private Sub UserForm_Activate()
' Read initial values from 4 rows after "My Range":
lCurrentRow = Range("My Range").Cells(4, 1).Row
LoadRow

I need to add listbox1 to this UserForm_Active sub.

I put a list box on the userform so that the user can select which
record to go to on the worksheet so they can edit the record through
the userform. I am not quite sure how to populate the data onto the
list box so the user can choose which record to go to.

I need the listbox to only be populated with data from column A
starting 4 rows after "My Range" through the next blank cell in column
A. Is there an easy way to do this and have the list box be more of a
drop down box?

Thanks in advance for any assistance.
 
G

Guest

Chris, replace the "ListBox" with a combobox, then add this line of code to
your Userform_Activate() sub:
ComboBox1.RowSource = Range(Range("MyRange").Offset(4), _
Range("MyRange").Offset(4).End(xlDown)).Address

Assuming that My Range is a named range and is actually "MyRange" as excel
doesn't like spaces.
 
C

Chris

I was able to get the list box populated, Thank you. The userform does
not pupulate with the new record though. Is there anyway to make it so
when I choose the the record # in the combobox, the userform populates
with the rest of the record? Thanks for your help, Charles.
 

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