ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   What is the difference in declaring a Collection in these Procedur (https://www.excelbanter.com/excel-programming/417669-what-difference-declaring-collection-these-procedur.html)

RyanH

What is the difference in declaring a Collection in these Procedur
 
Can someone tell me the difference in these two subs, if any difference at
all?

Sub BuildCollections()

Dim colAssignedDepts As Collection

Set colAssignedDepts = New Collection
With colAssignedDepts
.Add chkEngineering
.Add chkGraphProd
' add other checkboxes
End With
End Sub

Sub BuildCollections()

Dim colAssignedDepts As New Collection

With colAssignedDepts
.Add chkEngineering
.Add chkGraphProd
' add other checkboxes
End With
End Sub
--
Cheers,
Ryan

Doug Glancy

What is the difference in declaring a Collection in these Procedur
 
Ryan,

If you google things like ' "as new collection" "as collection" including:

http://discuss.fogcreek.com/joelonso...w&ixPost=24747

http://groups.google.com/groups?q=%2...L_enUS250US250

http://www.dailydoseofexcel.com/arch...ult-instances/

hth,

Doug

"RyanH" wrote in message
...
Can someone tell me the difference in these two subs, if any difference at
all?

Sub BuildCollections()

Dim colAssignedDepts As Collection

Set colAssignedDepts = New Collection
With colAssignedDepts
.Add chkEngineering
.Add chkGraphProd
' add other checkboxes
End With
End Sub

Sub BuildCollections()

Dim colAssignedDepts As New Collection

With colAssignedDepts
.Add chkEngineering
.Add chkGraphProd
' add other checkboxes
End With
End Sub
--
Cheers,
Ryan




Gary Keramidas

What is the difference in declaring a Collection in these Procedur
 
check out chip pearson's site
Don't Use The New Keyword In A Dim Statement
http://www.cpearson.com/Excel/variables.htm

--


Gary


"RyanH" wrote in message
...
Can someone tell me the difference in these two subs, if any difference at
all?

Sub BuildCollections()

Dim colAssignedDepts As Collection

Set colAssignedDepts = New Collection
With colAssignedDepts
.Add chkEngineering
.Add chkGraphProd
' add other checkboxes
End With
End Sub

Sub BuildCollections()

Dim colAssignedDepts As New Collection

With colAssignedDepts
.Add chkEngineering
.Add chkGraphProd
' add other checkboxes
End With
End Sub
--
Cheers,
Ryan





All times are GMT +1. The time now is 11:05 AM.

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