By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,487 Members | 1,735 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,487 IT Pros & Developers. It's quick & easy.

VBA Excel Macro

P: 67
I hope this is the right forum for this (if not let me know where i should have posted this) Alright I'm having a little trouble passing some arguments to a function and then having it return what I need it to.

Expand|Select|Wrap|Line Numbers
  1. Sub Startup()
  2.     ProcessCollection(colAbvs, 4)
  3. End Sub
  5. Function ProcessCollection(incCollection As Collection, specifiedLength As Integer)
  6.     For counter = 1 To incCollection.Count
  7.     tempString = incCollection.Count
  8.     stringLength = Len(tempString)
  9.     If (stringLength > specifiedLength) Then
  10.         MsgBox stringLength & " is greater than specified length"
  11.     ElseIf (stringLength < specifiedLength) Then
  12.         MsgBox stringLength & " is less than specified length"
  13.     ElseIf (stringLength = specifiedLength) Then
  14.         MsgBox "Equal"
  15. End Function
It doesn't seem to like me passing it arguments this way can someone let me know what im doing wrong.
Jun 18 '09 #1
Share this Question
Share on Google+
1 Reply

Expert 100+
P: 1,287
I haven't tried this with a Collection, but assuming that all works, line #7 would have to reference the variable counter instead of Count.
Jun 18 '09 #2

Post your reply

Sign in to post your reply or Sign up for a free account.