PC Review


Reply
Thread Tools Rate Thread

2 column List Box populated with data not from Excel sheet?

 
 
MariahJ
Guest
Posts: n/a
 
      11th Dec 2006
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 With Quote
 
 
 
 
MariahJ
Guest
Posts: n/a
 
      11th Dec 2006
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 With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I insert a work sheet populated with data into another? GMPierre Microsoft Excel Worksheet Functions 1 17th Jul 2008 09:12 PM
Sort List, Create Sheet for each unique item in column, move data J.W. Aldridge Microsoft Excel Programming 3 11th Apr 2008 07:33 PM
SUM formula for data from one column when another is populated Michael Microsoft Excel Programming 3 28th Jun 2007 01:48 PM
Having data automatically populated in a different sheet =?Utf-8?B?Tmlja2k=?= Microsoft Excel Worksheet Functions 0 14th Mar 2006 12:27 AM
detect column name of last populated data ilyaskazi Microsoft Excel Programming 3 25th Jul 2005 10:04 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:58 PM.