ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   ListBox Rowsource Limitation?? (https://www.excelbanter.com/excel-programming/278194-listbox-rowsource-limitation.html)

Dave Baranas

ListBox Rowsource Limitation??
 
I need to fill up a listbox with columns that are not next to each
other on a sheet

I have used main.lstbox.rowsource = "Sheet1!A2:R181"

then I tried

main.lstbox.rowsource = "Sheet1!A2:F181,Sheet1!I2:T181"

At least that one got by the compiler but I do not get the expected
results instead I get a blank list

I tried using a post where you make a union of ranges but that didn't
work out either.

I have a sheets with 200 columns across and depending on what page the
user is looking at I am tried to load up a list box with different
columns. If I could load up a listbox rowsource from columns on
diferent sheets that would just be awesome!

Any help on this one would be very appreciated

Regards,

Dave Baranas

Tom Ogilvy

ListBox Rowsource Limitation??
 
You can only use the rowsource on a contiguous range.

You will need to add the items using AddItem and then the list or column
commands.

--
Regards,
Tom Ogilvy

Dave Baranas wrote in message
om...
I need to fill up a listbox with columns that are not next to each
other on a sheet

I have used main.lstbox.rowsource = "Sheet1!A2:R181"

then I tried

main.lstbox.rowsource = "Sheet1!A2:F181,Sheet1!I2:T181"

At least that one got by the compiler but I do not get the expected
results instead I get a blank list

I tried using a post where you make a union of ranges but that didn't
work out either.

I have a sheets with 200 columns across and depending on what page the
user is looking at I am tried to load up a list box with different
columns. If I could load up a listbox rowsource from columns on
diferent sheets that would just be awesome!

Any help on this one would be very appreciated

Regards,

Dave Baranas




Dave Baranas

ListBox Rowsource Limitation??
 
Thanks for your reply Tom. I read through several of your posts on
this subject about trying to get this to work and I tried the 3 ways
below.

It seems like they all want to work and when I step throught the code
they all give me a 'Permission Denied' error when they try to read a
cell of the worksheet.

I put this at the very beginning of the initialize procedure and it
still didn't matter.

I don't have anything protected so I don't understand why this is
happening

I have seen other posts on this but never any clear answer to why. All
I know is that this stuff needs to be done in the initialization of
the form and when I make it the first thing the program is going to do
and this happens, I am starting to believe I am on a never ending
journey just to fill up a listbox.

Any help you can give will be very much appreciated,

Regards,

Dave Baranas
----------------------------------------

' With Mn.LstWlInd
' .ColumnCount = 16
' .Top = 0
' .Height = 309
' .ColumnWidths =
"35,35,70,45,45,40,60,60,45,55,55,55,55,55,55, 55"
' .List = Union(Range("Wdata!A2:F181"),
Range("Wdata!I2:P181")).Value
' End With


' For Each Cell In worksheets("Wdata").Range("A2:F181")
' Mn.LstWlInd.AddItem Cell.Value
' Next Cell



'IVal = -1
' With Mn.LstWlInd
' .ColumnCount = 16
' .Top = 0
' .Height = 309
' .ColumnWidths =
"35,35,70,45,45,40,60,60,45,55,55,55,55,55,55, 55"
' For Each Cell In worksheets("Wdata").Range("A2:F181,I2:P181")
' IVal = IVal + 1
' .AddItem Cell.Value
' For JVal = 1 To 5
' .List(IVal, JVal) = Cell.Offset(0, JVal).Value
' Next
' Next
' End With








----------------------------------------
"Tom Ogilvy" wrote in message ...
You can only use the rowsource on a contiguous range.

You will need to add the items using AddItem and then the list or column
commands.

--
Regards,
Tom Ogilvy

Dave Baranas wrote in message
om...
I need to fill up a listbox with columns that are not next to each
other on a sheet

I have used main.lstbox.rowsource = "Sheet1!A2:R181"

then I tried

main.lstbox.rowsource = "Sheet1!A2:F181,Sheet1!I2:T181"

At least that one got by the compiler but I do not get the expected
results instead I get a blank list

I tried using a post where you make a union of ranges but that didn't
work out either.

I have a sheets with 200 columns across and depending on what page the
user is looking at I am tried to load up a list box with different
columns. If I could load up a listbox rowsource from columns on
diferent sheets that would just be awesome!

Any help on this one would be very appreciated

Regards,

Dave Baranas



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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com