Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default 2 column List Box populated with data not from Excel sheet?

Hello,

I would like to populate a listbox with 2 columns of data. This data is
in an array called FirmNames. This is how I am doing it currently

With FirmList
For i = 1 To NumFirmNames
.AddItem (CStr(FirmNames(i).FirmName & vbTab &
FirmNames(i).Selected))
Next i
End With

However, the problem is that the FirmNames have different lengths, so
the second column does not line up.

I am much more familiar with forms in Access, and would like to do
something similar to the following:

For i = 1 To NumFirmNames
rowString = rowString & CStr(FirmNames(i).FirmName) &
"; " & FirmNames(i).Selected & "; "
Next i
FirmList.RowSource = rowString

(The column count property is set to 2). However, this gives me a
syntax error in Excel because the rowSource property here seems to be a
range on the Excel worksheet.

Any help would be greatly appreciated.

Thanks,
Mariah

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default 2 column List Box populated with data not from Excel sheet?

I have the column widths set. The problem is I don't know how to get
the data into 2 different columns. What I am doing now puts both
FirmNames(i).FirmName and FirmName(i).Selected into the same column.

JLGWhiz wrote:
You can set the column width with the ColumnWidths Property. See VBA Help
for details.

"MariahJ" wrote:

Hello,

I would like to populate a listbox with 2 columns of data. This data is
in an array called FirmNames. This is how I am doing it currently

With FirmList
For i = 1 To NumFirmNames
.AddItem (CStr(FirmNames(i).FirmName & vbTab &
FirmNames(i).Selected))
Next i
End With

However, the problem is that the FirmNames have different lengths, so
the second column does not line up.

I am much more familiar with forms in Access, and would like to do
something similar to the following:

For i = 1 To NumFirmNames
rowString = rowString & CStr(FirmNames(i).FirmName) &
"; " & FirmNames(i).Selected & "; "
Next i
FirmList.RowSource = rowString

(The column count property is set to 2). However, this gives me a
syntax error in Excel because the rowSource property here seems to be a
range on the Excel worksheet.

Any help would be greatly appreciated.

Thanks,
Mariah



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
Create Drop Down Box populated by a List Ted_MD Excel Discussion (Misc queries) 1 December 21st 09 03:32 PM
How do I insert a work sheet populated with data into another? GMPierre Excel Worksheet Functions 1 July 17th 08 09:12 PM
Drop-down list Populated by a Subset of a larger list RJH Excel Worksheet Functions 3 March 31st 06 10:28 PM
Having data automatically populated in a different sheet Nicki Excel Worksheet Functions 0 March 14th 06 12:27 AM
detect column name of last populated data ilyaskazi[_50_] Excel Programming 3 July 25th 05 09:53 AM


All times are GMT +1. The time now is 04:41 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"