Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
I'm trying to create a collection from a given range of cells. The code seems to run but the collection I try to create (in this case called "MainCategory") has no data in it. Can anybody help? Thanks, Derek Public MainCategory As New Collection Dim AllCells As Range Sub Test() <code Set AllCells = Range(Range("top_label").Offset(1, 0), Rang("top_label").End(xlDown)) ' Create a new collection Set MainCategory = CreateCollection(AllCells) End Sub Function CreateCollection(AllCells As Range) As Collection Dim Cell 'Prevents errors from trying to have duplicate entries On Error Resume Next For Each Cell In AllCells CreateCollection.Add Cell.Value, CStr(Cell.Value) Next Cell On Error GoTo 0 End Function |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
template for dvd collection | Excel Discussion (Misc queries) | |||
data collection | Excel Discussion (Misc queries) | |||
how do i create a data collection form in excel? | New Users to Excel | |||
Does anybody have a CD collection template | Excel Discussion (Misc queries) | |||
sheet collection | Excel Programming |