LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default Understanding the difference

Below are two programs that - to my understanding - are the same. Why does
the first one generate an error message and the second one not? Such small
differences (there is a similar thing with the Collection.add function) often
incur hours of debugging to me and therefore I would love to understand them.

1st:

Dim sums As New Collection
Dim colors As New Collection
Dim products As New Collection

If ExistsInColl(sums, color) Then "do stuff"

2nd:

Dim sums, colors, products As New Collection

If ExistsInColl(sums, color) Then "do stuff"


the function that is called:

Public Function ExistsInColl(ByRef col As Collection, ByVal index As String)
As Boolean
On Error GoTo ErrNotInColl
Dim tmp
tmp = col(index)
ExistsInColl = True
Exit Function
ErrNotInColl:
On Error GoTo 0
ExistsInColl = False
End Function
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
understanding of a formula sabi New Users to Excel 5 March 25th 09 08:43 AM
Understanding R1C1 Alex Excel Programming 5 June 25th 08 08:30 PM
Not understanding with/end with davegb Excel Programming 7 March 6th 06 09:42 PM
charting a difference of 2 columns' w/o adding a difference column Wab Charts and Charting in Excel 4 July 27th 05 02:37 AM
Not understanding If Not..Then nothing davegb Excel Programming 6 June 14th 05 04:49 PM


All times are GMT +1. The time now is 11:42 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"