ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   RowSource command (https://www.excelbanter.com/excel-programming/434001-rowsource-command.html)

bjorn[_2_]

RowSource command
 

I have a Row Source which is working quite well, however I have two
columns.
I require that when I select, both of them are showed, for example A2
and B2 show next to each other with a comma (,)
------------------

Sheets("Sheet1").Select

LPC.RowSource = "a1:b12358"


--
bjorn
------------------------------------------------------------------------
bjorn's Profile: http://www.thecodecage.com/forumz/member.php?userid=897
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=137426


Patrick Molloy[_2_]

RowSource command
 
you' need either to add a third column c, where c1:= =A1 & "," & B1
then set your rowsource to column C
OR
don't set the rowsource , but load the listbox on the form's initialise
routine

for each cell in range("Aa:A12358")
listbox1.AddItem cell.value & "," & cell.offset(,1).value
next

"bjorn" wrote:


I have a Row Source which is working quite well, however I have two
columns.
I require that when I select, both of them are showed, for example A2
and B2 show next to each other with a comma (,)
------------------

Sheets("Sheet1").Select

LPC.RowSource = "a1:b12358"


--
bjorn
------------------------------------------------------------------------
bjorn's Profile: http://www.thecodecage.com/forumz/member.php?userid=897
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=137426



bjorn[_3_]

RowSource command
 

I am quite new... I didn't quite understand this.

How am I to create the sum? Using for each cell in A = (a1, b12358)...

or initialise?

Is it possible to help me abit more please?


--
bjorn
------------------------------------------------------------------------
bjorn's Profile: http://www.thecodecage.com/forumz/member.php?userid=897
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=137426


Patrick Molloy[_2_]

RowSource command
 
I assume you have a userform with a listbox control?

then in then simply add this code

Private Sub UserForm_Initialize()
For Each cell In Range("Aa:A12358")
listbox1.AddItem cell.Value & "," & cell.Offset(, 1).Value
Next
End Sub





"bjorn" wrote:


I am quite new... I didn't quite understand this.

How am I to create the sum? Using for each cell in A = (a1, b12358)...

or initialise?

Is it possible to help me abit more please?


--
bjorn
------------------------------------------------------------------------
bjorn's Profile: http://www.thecodecage.com/forumz/member.php?userid=897
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=137426




All times are GMT +1. The time now is 01:40 PM.

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