Help with collections

  • Thread starter Thread starter ksnapp
  • Start date Start date
K

ksnapp

Im trying to learn how to use collections

for this example i've but 4 digit numbers in the cells C2:F2.
at this point i just want to get the data into a collection and the
look at the items individually in a msg box

here is my code thus far.


Sub collection()

Dim COL1 As New collection
Dim FRST
Dim SCND
Dim THRD
Dim FRTH

Range("c2:F2").Select
For Each cell In Selection
COL1.Add (cell.Value)
Next cell

FRST = COL1.Item(1).Value

MsgBox (FRST)

End Sub

help i just don't get i
 
Try changing

FRST = COL1.Item(1).Value

to

FRST = COL1.Item(1)

or

FRST = COL1(1)


probably not a good idea to vcall the sub collection


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Back
Top