I would. That way, you can test it independently of the rest.ou mean that I must I must move following loop into a new 'Private Function'?:
Also, since the previous function is a For-Next loop, it will only return the last result of the loop. If you place an exit point in that loop, then it would return the first result.
Three ways, Use a Module level Variable; Pass a local Variable "By Ref;" Use the Functions returnor there is another way to pass the result to previous Loop?
Dim ModLevelVar as String Function1() Call PrivateFunction 'or Private Sub, since the ModLevelVar is already Declared 'PrivateFunction/Sub sets the value of ModLevelVar at the Module level 'All Functions and Subs in the Module can use ModLevelVar DoStuff ModLevelVar End FunctionFunction1() Dim LocalVar PrivateFunction(ByRef LocalVar) 'Or Private Sub, since LocalVar is already Declared 'PrivateFunction/Sub Sets the Value of ByRef Variables outside the function 'LocalVar can not be used outside Function1 DoStuff to LocalVar End FunctionFunction1() Dim MyVar MyVar = PrivateFunction 'PrivateFunction Returns a Value 'PrivateFunction can be used anywhere in the Module End Function




Reply With Quote
