Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 71
Default help with adding list box to userform

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.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 272
Default help with adding list box to userform

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.
--
Charles Chickering

"A good example is twice the value of good advice."


"Chris" wrote:

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.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 71
Default help with adding list box to userform

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.

Charles Chickering wrote:
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.
--
Charles Chickering

"A good example is twice the value of good advice."


"Chris" wrote:

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.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding data to a worksheet from a UserForm Kezza Excel Programming 1 August 22nd 06 12:50 PM
adding more than one button to a userform at run-time [email protected] Excel Programming 1 July 26th 06 11:08 PM
Adding a Next Record button to UserForm excelnut1954 Excel Programming 1 February 2nd 06 03:28 PM
Userform to enter values and shown in same userform in list helmekki[_104_] Excel Programming 0 November 19th 05 03:23 PM
Adding controls to userform ExcelMonkey[_190_] Excel Programming 3 February 25th 05 11:30 AM


All times are GMT +1. The time now is 10:18 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"