#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Listbox

Hi everyone,

I have a listbox on a userform, that I created from the control toolbox,
that appears when a user changes the selection on a combo box. I can get the
form to appear with the listbox when the combobox is changed, but I can't get
the list box to populate with the info. The data that populates the list box
is named with a dynamic range. If I put the listbox directly onto the
worksheet, I can get it to fill with the listrangefill property with code I
wrote, but when I put it onto the userform I can't get it to fill. I tried
changing the code to the rowsorce property but that didn't work for me. Can
someone provide the code I need to have the listbox fill when the user form
is opened?

Thanks,

Scott
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 279
Default Listbox

post your rowsource attempt code

"Scott J" wrote:

Hi everyone,

I have a listbox on a userform, that I created from the control toolbox,
that appears when a user changes the selection on a combo box. I can get the
form to appear with the listbox when the combobox is changed, but I can't get
the list box to populate with the info. The data that populates the list box
is named with a dynamic range. If I put the listbox directly onto the
worksheet, I can get it to fill with the listrangefill property with code I
wrote, but when I put it onto the userform I can't get it to fill. I tried
changing the code to the rowsorce property but that didn't work for me. Can
someone provide the code I need to have the listbox fill when the user form
is opened?

Thanks,

Scott

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Listbox

Here it is:

dim listbox As Long
listbox = Sheets Data("data 3").range("an4:an500").end(xlUp).row
with worksheets("Item Tracker").listbox1
..ControlSource = Worksheet("data 3").range("listbox").address(external:=True)
End With

I am relatively new to coding so try not to be to brutal on me.

Thanks,

Scott J


"Vacation's Over" wrote:

post your rowsource attempt code

"Scott J" wrote:

Hi everyone,

I have a listbox on a userform, that I created from the control toolbox,
that appears when a user changes the selection on a combo box. I can get the
form to appear with the listbox when the combobox is changed, but I can't get
the list box to populate with the info. The data that populates the list box
is named with a dynamic range. If I put the listbox directly onto the
worksheet, I can get it to fill with the listrangefill property with code I
wrote, but when I put it onto the userform I can't get it to fill. I tried
changing the code to the rowsorce property but that didn't work for me. Can
someone provide the code I need to have the listbox fill when the user form
is opened?

Thanks,

Scott

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 279
Default Listbox

OK
first it may take a while but you need to learn the differernce between
variable types.
Next DONOT use "simple variable names" microsoft has taken them and you
will get confused between your listbox variable and the listbox Control (an
object).

third in this case control source and listbox source are different (look in
VBA help)

You can assign a cell refernce to a control but a list box is a special
control that allows you to assign a range.
your selection of entire row puts250 items into the list box (many blank?)
be more specific with the columns you need for the listbox selections

Sooo play with this and post back:

dim mylistboxsource as range
set mylistboxsource =Thisworkbook.Sheets("data 3").range(bespecific)
' SP: "set" required for objects
..rowsource = mylistboxsource

msgbox mylistboxsource.address
' use message boxes durring coding to show what the PC thinks you said



"Scott J" wrote:

Here it is:

dim listbox As Long
listbox = Sheets Data("data 3").range("an4:an500").end(xlUp).row
with worksheets("Item Tracker").listbox1
.ControlSource = Worksheet("data 3").range("listbox").address(external:=True)
End With

I am relatively new to coding so try not to be to brutal on me.

Thanks,

Scott J


"Vacation's Over" wrote:

post your rowsource attempt code

"Scott J" wrote:

Hi everyone,

I have a listbox on a userform, that I created from the control toolbox,
that appears when a user changes the selection on a combo box. I can get the
form to appear with the listbox when the combobox is changed, but I can't get
the list box to populate with the info. The data that populates the list box
is named with a dynamic range. If I put the listbox directly onto the
worksheet, I can get it to fill with the listrangefill property with code I
wrote, but when I put it onto the userform I can't get it to fill. I tried
changing the code to the rowsorce property but that didn't work for me. Can
someone provide the code I need to have the listbox fill when the user form
is opened?

Thanks,

Scott

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Listbox

Thanks for the help.....I will play with this and let you know how it turns
out.

"Vacation's Over" wrote:

OK
first it may take a while but you need to learn the differernce between
variable types.
Next DONOT use "simple variable names" microsoft has taken them and you
will get confused between your listbox variable and the listbox Control (an
object).

third in this case control source and listbox source are different (look in
VBA help)

You can assign a cell refernce to a control but a list box is a special
control that allows you to assign a range.
your selection of entire row puts250 items into the list box (many blank?)
be more specific with the columns you need for the listbox selections

Sooo play with this and post back:

dim mylistboxsource as range
set mylistboxsource =Thisworkbook.Sheets("data 3").range(bespecific)
' SP: "set" required for objects
.rowsource = mylistboxsource

msgbox mylistboxsource.address
' use message boxes durring coding to show what the PC thinks you said



"Scott J" wrote:

Here it is:

dim listbox As Long
listbox = Sheets Data("data 3").range("an4:an500").end(xlUp).row
with worksheets("Item Tracker").listbox1
.ControlSource = Worksheet("data 3").range("listbox").address(external:=True)
End With

I am relatively new to coding so try not to be to brutal on me.

Thanks,

Scott J


"Vacation's Over" wrote:

post your rowsource attempt code

"Scott J" wrote:

Hi everyone,

I have a listbox on a userform, that I created from the control toolbox,
that appears when a user changes the selection on a combo box. I can get the
form to appear with the listbox when the combobox is changed, but I can't get
the list box to populate with the info. The data that populates the list box
is named with a dynamic range. If I put the listbox directly onto the
worksheet, I can get it to fill with the listrangefill property with code I
wrote, but when I put it onto the userform I can't get it to fill. I tried
changing the code to the rowsorce property but that didn't work for me. Can
someone provide the code I need to have the listbox fill when the user form
is opened?

Thanks,

Scott

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
listbox B conditional of input in Listbox A Kim K Excel Discussion (Misc queries) 1 October 31st 06 08:27 PM
VBA: Creating listbox similar to the one in Pivot table (Listbox+Checkbox) modjoe23 Excel Programming 3 August 18th 05 02:35 PM
Multicolumn Listbox and ordinary listbox Ron_D Excel Programming 0 June 4th 04 08:56 PM
listbox.value not equal to listbox.list(listbox.listindex,0) ARB Excel Programming 0 October 22nd 03 12:46 AM
Is refreshing listbox rowsource in listbox click event possible? Jeremy Gollehon[_2_] Excel Programming 4 September 25th 03 06:45 PM


All times are GMT +1. The time now is 07:07 AM.

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"