Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Return a Value from a Sub 1

Status
Not open for further replies.

Kaos2800

Programmer
Jan 16, 2001
17
US
What I want to do is this.

Sub CompleteForm()
Dim SomeVal As Interger

SomeVal = SomeOtherSub()

End

Private Sub SomeOtherSub()
Some test performed here

Return PerformedTestValue
End

If I can find a Working example of something like this it would be great. I hate having so many Global Variables at the top of my code.
 
Hi,

What you want to do is perform a function
Code:
Sub CompleteForm()
    Dim SomeVal As Integer

    SomeVal = SomeOtherFunction(SomeOtherValue)
End Sub
Function SomeOtherFunction(SomeOtherValue) As Integer
    'Some test performed here
    
    SomeOtherFunction = PerformedTestValue
End Function
Skip,
 
"Kaos strikes again"... and he didn't even leave a "thread reminder".

Given Skip's "never ending" efforts, it's appropriate that he should get a ======> STAR

Kaos... In case you happen to read this, or for anyone else who is reasonably new to Tek-Tips, here's the "proper" way to "show appreciation and recognition" for anyone who takes the time to provide a solution to your problem or question.

Simply click on the "Click here to mark this post as a helpful or expert post!" - located in the lower-left corner of the contributor's posting.

Please...NO star for this reminder - I want to earn stars in the normal way. Thanks.

Regards, ...Dale Watson dwatson@bsi.gov.mb.ca
 
My mistake, I forgot. What's funny is my cousins are the Watsons.

-David
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top