PC Review


Reply
Thread Tools Rate Thread

Adding selected items from one list box to two different list boxe

 
 
Genix
Guest
Posts: n/a
 
      12th Mar 2009

I created a userform, also have made three list boxes

List box 2 contains a default list of 10 companies I want selected, I want
the user to select two companies from here. Then the values (stored in
sheet.1 range) for the 1st company dropped into List box 3 and the other into
List box 4.

Currently, I am receiving a runtime error message '9' saying 'subscript out
of range'. please can someone help me sort this out. I pasted the relevant
part of the code below (I know am an amature VBA programmer). Thank you as I
await a response








Dim numofStock As Integer, daily As Integer, countSelected As Integer,
countSelectedi As Integer, countSelectedii As Integer
Dim column As Integer, row As Integer, i As Integer, j As Integer, k As
Integer, L As Integer
Dim SelectedStocki() As Variant, Stock() As Variant, SelectedStockii() As
Variant

numofStock = 10
daily = 1283
countSelectedi = 0
countSelectedii = 0

ReDim SelectedStocki(1 To daily, 1 To numofStock), Stock(1 To daily, 1 To
numofStock)
ReDim SelectedStockii(1 To daily, 1 To numofStock), Stock(1 To daily, 1 To
numofStock)

Stock = Sheet1.Range("Returns").Value

For column = 0 To numofStock - 1
If ListBox2.Selected(column) = True Then
countSelected = countSelectedi
countSelected = countSelectedii
Selection(countSelectedi) = ListBox2.List(column)
Selection(countSelectedii) = ListBox2.List(column)
For row = 1 To daily
SelectedStocki(row, countSelectedi) = Stock(row, column + 1)
Next row
For row = 1 To daily
SelectedStockii(row, countSelectedii) = Stock(row, column + 1)
Next row
End If
Next column
'Next column

ReDim Preserve SelectedStocki(1 To daily, 1 To countSelectedi)
ReDim Preserve SelectedStockii(1 To daily, 1 To countSelectedii)

With ListBox3
For j = 1 To countSelectedi
For i = 1 To daily
.AddItem Stock(i, j)
Next i
Next j
End With

With ListBox4
For k = 1 To countSelectedii
For L = 1 To daily
.AddItem Stock(k, L)
Next L
Next k
End With
 
Reply With Quote
 
 
 
 
Per Jessen
Guest
Posts: n/a
 
      12th Mar 2009
Hi



Which line is highlighted when you click Debug?

Regards,
Per

"Genix" <(E-Mail Removed)> skrev i meddelelsen
news:9FA80AFD-D02D-4AAC-9978-(E-Mail Removed)...
>
> I created a userform, also have made three list boxes
>
> List box 2 contains a default list of 10 companies I want selected, I want
> the user to select two companies from here. Then the values (stored in
> sheet.1 range) for the 1st company dropped into List box 3 and the other
> into
> List box 4.
>
> Currently, I am receiving a runtime error message '9' saying 'subscript
> out
> of range'. please can someone help me sort this out. I pasted the relevant
> part of the code below (I know am an amature VBA programmer). Thank you as
> I
> await a response
>
>
>
>
>
>
>
>
> Dim numofStock As Integer, daily As Integer, countSelected As Integer,
> countSelectedi As Integer, countSelectedii As Integer
> Dim column As Integer, row As Integer, i As Integer, j As Integer, k As
> Integer, L As Integer
> Dim SelectedStocki() As Variant, Stock() As Variant, SelectedStockii() As
> Variant
>
> numofStock = 10
> daily = 1283
> countSelectedi = 0
> countSelectedii = 0
>
> ReDim SelectedStocki(1 To daily, 1 To numofStock), Stock(1 To daily, 1 To
> numofStock)
> ReDim SelectedStockii(1 To daily, 1 To numofStock), Stock(1 To daily, 1 To
> numofStock)
>
> Stock = Sheet1.Range("Returns").Value
>
> For column = 0 To numofStock - 1
> If ListBox2.Selected(column) = True Then
> countSelected = countSelectedi
> countSelected = countSelectedii
> Selection(countSelectedi) = ListBox2.List(column)
> Selection(countSelectedii) = ListBox2.List(column)
> For row = 1 To daily
> SelectedStocki(row, countSelectedi) = Stock(row, column + 1)
> Next row
> For row = 1 To daily
> SelectedStockii(row, countSelectedii) = Stock(row, column + 1)
> Next row
> End If
> Next column
> 'Next column
>
> ReDim Preserve SelectedStocki(1 To daily, 1 To countSelectedi)
> ReDim Preserve SelectedStockii(1 To daily, 1 To countSelectedii)
>
> With ListBox3
> For j = 1 To countSelectedi
> For i = 1 To daily
> .AddItem Stock(i, j)
> Next i
> Next j
> End With
>
> With ListBox4
> For k = 1 To countSelectedii
> For L = 1 To daily
> .AddItem Stock(k, L)
> Next L
> Next k
> End With


 
Reply With Quote
 
Genix
Guest
Posts: n/a
 
      12th Mar 2009
Hi Per Jessen,
I hope you are still there. Thank you very much I have copied out the line
below. Please see what you can do. thank you

SelectedStocki(row, countSelectedi) = Stock(row, column + 1)

Genix


"Per Jessen" wrote:

> Hi
>
>
>
> Which line is highlighted when you click Debug?
>
> Regards,
> Per
>
> "Genix" <(E-Mail Removed)> skrev i meddelelsen
> news:9FA80AFD-D02D-4AAC-9978-(E-Mail Removed)...
> >
> > I created a userform, also have made three list boxes
> >
> > List box 2 contains a default list of 10 companies I want selected, I want
> > the user to select two companies from here. Then the values (stored in
> > sheet.1 range) for the 1st company dropped into List box 3 and the other
> > into
> > List box 4.
> >
> > Currently, I am receiving a runtime error message '9' saying 'subscript
> > out
> > of range'. please can someone help me sort this out. I pasted the relevant
> > part of the code below (I know am an amature VBA programmer). Thank you as
> > I
> > await a response
> >
> >
> >
> >
> >
> >
> >
> >
> > Dim numofStock As Integer, daily As Integer, countSelected As Integer,
> > countSelectedi As Integer, countSelectedii As Integer
> > Dim column As Integer, row As Integer, i As Integer, j As Integer, k As
> > Integer, L As Integer
> > Dim SelectedStocki() As Variant, Stock() As Variant, SelectedStockii() As
> > Variant
> >
> > numofStock = 10
> > daily = 1283
> > countSelectedi = 0
> > countSelectedii = 0
> >
> > ReDim SelectedStocki(1 To daily, 1 To numofStock), Stock(1 To daily, 1 To
> > numofStock)
> > ReDim SelectedStockii(1 To daily, 1 To numofStock), Stock(1 To daily, 1 To
> > numofStock)
> >
> > Stock = Sheet1.Range("Returns").Value
> >
> > For column = 0 To numofStock - 1
> > If ListBox2.Selected(column) = True Then
> > countSelected = countSelectedi
> > countSelected = countSelectedii
> > Selection(countSelectedi) = ListBox2.List(column)
> > Selection(countSelectedii) = ListBox2.List(column)
> > For row = 1 To daily
> > SelectedStocki(row, countSelectedi) = Stock(row, column + 1)
> > Next row
> > For row = 1 To daily
> > SelectedStockii(row, countSelectedii) = Stock(row, column + 1)
> > Next row
> > End If
> > Next column
> > 'Next column
> >
> > ReDim Preserve SelectedStocki(1 To daily, 1 To countSelectedi)
> > ReDim Preserve SelectedStockii(1 To daily, 1 To countSelectedii)
> >
> > With ListBox3
> > For j = 1 To countSelectedi
> > For i = 1 To daily
> > .AddItem Stock(i, j)
> > Next i
> > Next j
> > End With
> >
> > With ListBox4
> > For k = 1 To countSelectedii
> > For L = 1 To daily
> > .AddItem Stock(k, L)
> > Next L
> > Next k
> > End With

>
>

 
Reply With Quote
 
Genix
Guest
Posts: n/a
 
      12th Mar 2009

Hi Per, please did I get lucky? Did you find anything yet?

Thanks


"Per Jessen" wrote:

> Hi
>
>
>
> Which line is highlighted when you click Debug?
>
> Regards,
> Per
>
> "Genix" <(E-Mail Removed)> skrev i meddelelsen
> news:9FA80AFD-D02D-4AAC-9978-(E-Mail Removed)...
> >
> > I created a userform, also have made three list boxes
> >
> > List box 2 contains a default list of 10 companies I want selected, I want
> > the user to select two companies from here. Then the values (stored in
> > sheet.1 range) for the 1st company dropped into List box 3 and the other
> > into
> > List box 4.
> >
> > Currently, I am receiving a runtime error message '9' saying 'subscript
> > out
> > of range'. please can someone help me sort this out. I pasted the relevant
> > part of the code below (I know am an amature VBA programmer). Thank you as
> > I
> > await a response
> >
> >
> >
> >
> >
> >
> >
> >
> > Dim numofStock As Integer, daily As Integer, countSelected As Integer,
> > countSelectedi As Integer, countSelectedii As Integer
> > Dim column As Integer, row As Integer, i As Integer, j As Integer, k As
> > Integer, L As Integer
> > Dim SelectedStocki() As Variant, Stock() As Variant, SelectedStockii() As
> > Variant
> >
> > numofStock = 10
> > daily = 1283
> > countSelectedi = 0
> > countSelectedii = 0
> >
> > ReDim SelectedStocki(1 To daily, 1 To numofStock), Stock(1 To daily, 1 To
> > numofStock)
> > ReDim SelectedStockii(1 To daily, 1 To numofStock), Stock(1 To daily, 1 To
> > numofStock)
> >
> > Stock = Sheet1.Range("Returns").Value
> >
> > For column = 0 To numofStock - 1
> > If ListBox2.Selected(column) = True Then
> > countSelected = countSelectedi
> > countSelected = countSelectedii
> > Selection(countSelectedi) = ListBox2.List(column)
> > Selection(countSelectedii) = ListBox2.List(column)
> > For row = 1 To daily
> > SelectedStocki(row, countSelectedi) = Stock(row, column + 1)
> > Next row
> > For row = 1 To daily
> > SelectedStockii(row, countSelectedii) = Stock(row, column + 1)
> > Next row
> > End If
> > Next column
> > 'Next column
> >
> > ReDim Preserve SelectedStocki(1 To daily, 1 To countSelectedi)
> > ReDim Preserve SelectedStockii(1 To daily, 1 To countSelectedii)
> >
> > With ListBox3
> > For j = 1 To countSelectedi
> > For i = 1 To daily
> > .AddItem Stock(i, j)
> > Next i
> > Next j
> > End With
> >
> > With ListBox4
> > For k = 1 To countSelectedii
> > For L = 1 To daily
> > .AddItem Stock(k, L)
> > Next L
> > Next k
> > End With

>
>

 
Reply With Quote
 
Per Jessen
Guest
Posts: n/a
 
      13th Mar 2009
Hi Genix

Think I solved it.

The variable countSelectedi is equal to zero, and you have declared
SelectedStocki(from 1 to..) To verify that the variable value is zero
hold the mouse pointer over the variable when you click Debug.

Not sure what you are trying to do with theese lines:

countSelected = countSelectedi
countSelected = countSelectedii
Selection(countSelectedi) = ListBox2.List(column)
Selection(countSelectedii) = ListBox2.List(column)

First you set countSelected equal to countSelectedi then equal to
countSelectedii !?!

I just can't imagine what you want the two last lines to do.

Hopes this helps

---Per




On 13 Mar., 00:37, Genix <Ge...@discussions.microsoft.com> wrote:
> HiPer, please did I get lucky? Did you find anything yet?
>
> Thanks
>
>
>
> "PerJessen" wrote:
> > Hi

>
> > Which line is highlighted when you click Debug?

>
> > Regards,
> >Per

>
> > "Genix" <Ge...@discussions.microsoft.com> skrev i meddelelsen
> >news:9FA80AFD-D02D-4AAC-9978-(E-Mail Removed)...

>
> > > I created a userform, also have made three list boxes

>
> > > List box 2 contains a default list of 10 companies I want selected, Iwant
> > > the user to select two companies from here. Then the values (stored in
> > > sheet.1 range) for the 1st company dropped into List box 3 and the other
> > > into
> > > List box 4.

>
> > > Currently, I am receiving a runtime error message '9' saying 'subscript
> > > out
> > > of range'. please can someone help me sort this out. I pasted the relevant
> > > part of the code below (I know am an amature VBA programmer). Thank you as
> > > I
> > > await a response

>
> > > Dim numofStock As Integer, daily As Integer, countSelected As Integer,
> > > countSelectedi As Integer, countSelectedii As Integer
> > > Dim column As Integer, row As Integer, i As Integer, j As Integer, k As
> > > Integer, L As Integer
> > > Dim SelectedStocki() As Variant, Stock() As Variant, SelectedStockii() As
> > > Variant

>
> > > numofStock = 10
> > > daily = 1283
> > > countSelectedi = 0
> > > countSelectedii = 0

>
> > > ReDim SelectedStocki(1 To daily, 1 To numofStock), Stock(1 To daily, 1 To
> > > numofStock)
> > > ReDim SelectedStockii(1 To daily, 1 To numofStock), Stock(1 To daily,1 To
> > > numofStock)

>
> > > Stock = Sheet1.Range("Returns").Value

>
> > > For column = 0 To numofStock - 1
> > > * *If ListBox2.Selected(column) = True Then
> > > * * * *countSelected = countSelectedi
> > > * * * *countSelected = countSelectedii
> > > * * * *Selection(countSelectedi) = ListBox2.List(column)
> > > * * * *Selection(countSelectedii) = ListBox2.List(column)
> > > * * * *For row = 1 To daily
> > > * * * * * *SelectedStocki(row, countSelectedi) = Stock(row, column + 1)
> > > * * * *Next row
> > > * * * *For row = 1 To daily
> > > * * * * * *SelectedStockii(row, countSelectedii) = Stock(row, column + 1)
> > > * * * *Next row
> > > * *End If
> > > Next column
> > > 'Next column

>
> > > ReDim Preserve SelectedStocki(1 To daily, 1 To countSelectedi)
> > > ReDim Preserve SelectedStockii(1 To daily, 1 To countSelectedii)

>
> > > With ListBox3
> > > * *For j = 1 To countSelectedi
> > > * * * *For i = 1 To daily
> > > * * * * * *.AddItem Stock(i, j)
> > > * * * *Next i
> > > * *Next j
> > > End With

>
> > > With ListBox4
> > > * *For k = 1 To countSelectedii
> > > * * * *For L = 1 To daily
> > > * * * * * *.AddItem Stock(k, L)
> > > * * * *Next L
> > > * *Next k
> > > End With- Skjul tekst i anførselstegn -

>
> - Vis tekst i anførselstegn -


 
Reply With Quote
 
Genix
Guest
Posts: n/a
 
      13th Mar 2009
Hi Per,
Before I declare you my 'guru' please clarify, do I therefore declare it
equal to 1 rather? (for the error)

For the two lines, I am trying to tell VBA that when a user selects two
companies from the default companies list in List.box 2 column, VBA should
pick the first selection corresponding values for the range and place them
into a List.box 3.

Also, the second selection values should be placed in another List box named
4.

Actually, this is what I am trying to solve and not the error at such
because thats my objective to - take values for two companies in one list and
drop them individually into two separate list boxes. I think I am getting the
logic skewed

Please, any suggestions will be welcomed. Thank you, Per

Genix

"Per Jessen" wrote:

> Hi Genix
>
> Think I solved it.
>
> The variable countSelectedi is equal to zero, and you have declared
> SelectedStocki(from 1 to..) To verify that the variable value is zero
> hold the mouse pointer over the variable when you click Debug.
>
> Not sure what you are trying to do with theese lines:
>
> countSelected = countSelectedi
> countSelected = countSelectedii
> Selection(countSelectedi) = ListBox2.List(column)
> Selection(countSelectedii) = ListBox2.List(column)
>
> First you set countSelected equal to countSelectedi then equal to
> countSelectedii !?!
>
> I just can't imagine what you want the two last lines to do.
>
> Hopes this helps
>
> ---Per
>
>
>
>
> On 13 Mar., 00:37, Genix <Ge...@discussions.microsoft.com> wrote:
> > HiPer, please did I get lucky? Did you find anything yet?
> >
> > Thanks
> >
> >
> >
> > "PerJessen" wrote:
> > > Hi

> >
> > > Which line is highlighted when you click Debug?

> >
> > > Regards,
> > >Per

> >
> > > "Genix" <Ge...@discussions.microsoft.com> skrev i meddelelsen
> > >news:9FA80AFD-D02D-4AAC-9978-(E-Mail Removed)...

> >
> > > > I created a userform, also have made three list boxes

> >
> > > > List box 2 contains a default list of 10 companies I want selected, I want
> > > > the user to select two companies from here. Then the values (stored in
> > > > sheet.1 range) for the 1st company dropped into List box 3 and the other
> > > > into
> > > > List box 4.

> >
> > > > Currently, I am receiving a runtime error message '9' saying 'subscript
> > > > out
> > > > of range'. please can someone help me sort this out. I pasted the relevant
> > > > part of the code below (I know am an amature VBA programmer). Thank you as
> > > > I
> > > > await a response

> >
> > > > Dim numofStock As Integer, daily As Integer, countSelected As Integer,
> > > > countSelectedi As Integer, countSelectedii As Integer
> > > > Dim column As Integer, row As Integer, i As Integer, j As Integer, k As
> > > > Integer, L As Integer
> > > > Dim SelectedStocki() As Variant, Stock() As Variant, SelectedStockii() As
> > > > Variant

> >
> > > > numofStock = 10
> > > > daily = 1283
> > > > countSelectedi = 0
> > > > countSelectedii = 0

> >
> > > > ReDim SelectedStocki(1 To daily, 1 To numofStock), Stock(1 To daily, 1 To
> > > > numofStock)
> > > > ReDim SelectedStockii(1 To daily, 1 To numofStock), Stock(1 To daily, 1 To
> > > > numofStock)

> >
> > > > Stock = Sheet1.Range("Returns").Value

> >
> > > > For column = 0 To numofStock - 1
> > > > If ListBox2.Selected(column) = True Then
> > > > countSelected = countSelectedi
> > > > countSelected = countSelectedii
> > > > Selection(countSelectedi) = ListBox2.List(column)
> > > > Selection(countSelectedii) = ListBox2.List(column)
> > > > For row = 1 To daily
> > > > SelectedStocki(row, countSelectedi) = Stock(row, column + 1)
> > > > Next row
> > > > For row = 1 To daily
> > > > SelectedStockii(row, countSelectedii) = Stock(row, column + 1)
> > > > Next row
> > > > End If
> > > > Next column
> > > > 'Next column

> >
> > > > ReDim Preserve SelectedStocki(1 To daily, 1 To countSelectedi)
> > > > ReDim Preserve SelectedStockii(1 To daily, 1 To countSelectedii)

> >
> > > > With ListBox3
> > > > For j = 1 To countSelectedi
> > > > For i = 1 To daily
> > > > .AddItem Stock(i, j)
> > > > Next i
> > > > Next j
> > > > End With

> >
> > > > With ListBox4
> > > > For k = 1 To countSelectedii
> > > > For L = 1 To daily
> > > > .AddItem Stock(k, L)
> > > > Next L
> > > > Next k
> > > > End With- Skjul tekst i anførselstegn -

> >
> > - Vis tekst i anførselstegn -

>
>

 
Reply With Quote
 
Per Jessen
Guest
Posts: n/a
 
      13th Mar 2009
Hi Genix

I'm still a bit confused...

but maybe the code below is what you need. If it doesn't help, you can
mail me a sample workbook with a description of what to do, and I'LL
give it a look.

Sub aaa()
Dim numofStock As Integer, daily As Integer, countSelected As Integer,
CountSelectedA As Integer, CountSelectedB As Integer
Dim column As Integer, row As Integer, i As Integer, j As Integer, k
As Integer, L As Integer
Dim SelectedStockA() As Variant, Stock() As Variant, SelectedStockB()
As Variant


numofStock = 10
daily = 1283
CountSelectedA = -1
CountSelectedB = -1

ReDim SelectedStockA(1 To daily, 1 To numofStock), Stock(1 To daily, 1
To numofStock)
ReDim SelectedStockB(1 To daily, 1 To numofStock), Stock(1 To daily, 1
To numofStock)

Stock = Sheet1.Range("Returns").Value

'Find two selected companies
For column = 0 To numofStock - 1
If me.listbox2.Selected(column) = True Then
If CountSelectedA = -1 Then
CountSelectedA = Me.listbox2.List(column)
Else
CountSelectedB = Me.listbox2.List(column)
End If
End If
Next
For column = 0 To numofStock - 1
For row = 1 To daily
SelectedStockA(row, CountSelectedA) = Stock(row, column + 1)
SelectedStockB(row, CountSelectedB) = Stock(row, column + 1)
Next row
Next

'Next column

' Why do you need to ReDim ?
ReDim Preserve SelectedStockA(1 To daily, 1 To CountSelectedA)
ReDim Preserve SelectedStockB(1 To daily, 1 To CountSelectedB)


With me.ListBox3
For j = 1 To CountSelectedA
For i = 1 To daily
.AddItem Stock(i, j)
Next i
Next j
End With


With me.ListBox4
For k = 1 To CountSelectedB
For L = 1 To daily
.AddItem Stock(k, L)
Next L
Next k
End With
End Sub

Hopes this helps
---

Per

On 13 Mar., 03:00, Genix <Ge...@discussions.microsoft.com> wrote:
> Hi Per,
> Before I declare you my 'guru' please clarify, do I therefore declare it
> equal to 1 rather? (for the error)
>
> For the two lines, I am trying to tell VBA that when a user selects two
> companies from the default companies list in List.box 2 column, VBA should
> pick the first selection corresponding values for the range and place them
> into a List.box 3.
>
> Also, the second selection values should be placed in another List box named
> 4.
>
> Actually, this is what I am trying to solve and not the error at such
> because thats my objective to - take values for two companies in one listand
> drop them individually into two separate list boxes. I think I am gettingthe
> logic skewed
>
> Please, any suggestions will be welcomed. Thank you, Per
>
> Genix
>
>
>
> "Per Jessen" wrote:
> > Hi Genix

>
> > Think I solved it.

>
> > The variable countSelectedi is equal to zero, and you have declared
> > SelectedStocki(from 1 to..) To verify that the variable value is zero
> > hold the mouse pointer over the variable when you click Debug.

>
> > Not sure what you are trying to do with theese lines:

>
> > countSelected = countSelectedi
> > countSelected = countSelectedii
> > Selection(countSelectedi) = ListBox2.List(column)
> > Selection(countSelectedii) = ListBox2.List(column)

>
> > First you set countSelected equal to countSelectedi then equal to
> > countSelectedii !?!

>
> > I just can't imagine what you want the two last lines to do.

>
> > Hopes this helps

>
> > ---Per

>
> > On 13 Mar., 00:37, Genix <Ge...@discussions.microsoft.com> wrote:
> > > HiPer, please did I get lucky? Did you find anything yet?

>
> > > Thanks

>
> > > "PerJessen" wrote:
> > > > Hi

>
> > > > Which line is highlighted when you click Debug?

>
> > > > Regards,
> > > >Per

>
> > > > "Genix" <Ge...@discussions.microsoft.com> skrev i meddelelsen
> > > >news:9FA80AFD-D02D-4AAC-9978-(E-Mail Removed)...

>
> > > > > I created a userform, also have made three list boxes

>
> > > > > List box 2 contains a default list of 10 companies I want selected, I want
> > > > > the user to select two companies from here. Then the values (stored in
> > > > > sheet.1 range) for the 1st company dropped into List box 3 and the other
> > > > > into
> > > > > List box 4.

>
> > > > > Currently, I am receiving a runtime error message '9' saying 'subscript
> > > > > out
> > > > > of range'. please can someone help me sort this out. I pasted therelevant
> > > > > part of the code below (I know am an amature VBA programmer). Thank you as
> > > > > I
> > > > > await a response

>
> > > > > Dim numofStock As Integer, daily As Integer, countSelected As Integer,
> > > > > countSelectedi As Integer, countSelectedii As Integer
> > > > > Dim column As Integer, row As Integer, i As Integer, j As Integer, k As
> > > > > Integer, L As Integer
> > > > > Dim SelectedStocki() As Variant, Stock() As Variant, SelectedStockii() As
> > > > > Variant

>
> > > > > numofStock = 10
> > > > > daily = 1283
> > > > > countSelectedi = 0
> > > > > countSelectedii = 0

>
> > > > > ReDim SelectedStocki(1 To daily, 1 To numofStock), Stock(1 To daily, 1 To
> > > > > numofStock)
> > > > > ReDim SelectedStockii(1 To daily, 1 To numofStock), Stock(1 To daily, 1 To
> > > > > numofStock)

>
> > > > > Stock = Sheet1.Range("Returns").Value

>
> > > > > For column = 0 To numofStock - 1
> > > > > * *If ListBox2.Selected(column) = True Then
> > > > > * * * *countSelected = countSelectedi
> > > > > * * * *countSelected = countSelectedii
> > > > > * * * *Selection(countSelectedi) = ListBox2.List(column)
> > > > > * * * *Selection(countSelectedii) = ListBox2.List(column)
> > > > > * * * *For row = 1 To daily
> > > > > * * * * * *SelectedStocki(row, countSelectedi) = Stock(row, column + 1)
> > > > > * * * *Next row
> > > > > * * * *For row = 1 To daily
> > > > > * * * * * *SelectedStockii(row, countSelectedii) = Stock(row, column + 1)
> > > > > * * * *Next row
> > > > > * *End If
> > > > > Next column
> > > > > 'Next column

>
> > > > > ReDim Preserve SelectedStocki(1 To daily, 1 To countSelectedi)
> > > > > ReDim Preserve SelectedStockii(1 To daily, 1 To countSelectedii)

>
> > > > > With ListBox3
> > > > > * *For j = 1 To countSelectedi
> > > > > * * * *For i = 1 To daily
> > > > > * * * * * *.AddItem Stock(i, j)
> > > > > * * * *Next i
> > > > > * *Next j
> > > > > End With

>
> > > > > With ListBox4
> > > > > * *For k = 1 To countSelectedii
> > > > > * * * *For L = 1 To daily
> > > > > * * * * * *.AddItem Stock(k, L)
> > > > > * * * *Next L
> > > > > * *Next k
> > > > > End With- Skjul tekst i anførselstegn -

>
> > > - Vis tekst i anførselstegn -- Skjul tekst i anførselstegn -

>
> - Vis tekst i anførselstegn -


 
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
Save selected items NOT selected in an Extended List Box based onother condition big.brown Microsoft Access Form Coding 6 8th Oct 2009 06:57 PM
List and subtotal selected items, then print separate item list TitanG Microsoft Excel Worksheet Functions 0 8th Sep 2008 09:07 PM
Items selected from List Box =?Utf-8?B?amtsbQ==?= Microsoft Access Form Coding 1 15th Nov 2007 09:54 AM
named range, data validation: list non-selected items, and new added items KR Microsoft Excel Misc 1 24th Jun 2005 05:21 AM
Multi-Selected Items from one List Box to other empty List Box and text box Sumit Microsoft Access Form Coding 3 15th Jul 2003 09:11 AM


Features
 

Advertising
 

Newsgroups
 


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