Re: Get values for function



It sounds like you might not understand what you are saying
;-)

This is a very simple concept so if you are having a problem
with it, you should provide enough of your code to
demonstrate whatever issue is causeing trouble. At least
you can then use the names of the arguments/variables to
illuminate your question.
--
Marsh
MVP [MS Access]


Kou Vang wrote:

I guess I'm trying to pass an argument from a sub into a function to get a
value back into the sub. Would it just makes things easier, if I just moved
the argument into the function and out of the sub, then pass it into the sub?
I hope I understand what I'm saying now.


Kou Vang wrote:
If I call a function, how do I get the values gathered before making a call
to the function if I call the function in the middle of script? I have run
into this several times, as I don't want to have to keep asking for the same
values that may be used inside the function. Exp:

dim x

x = 25

call some function

y = x ' x should be 25


"Marshall Barton" wrote:
It sounds like you are asking about using arguments to a
procedure?? If so, check VBA Help for:
Function Statement

The basic idea is:

Public Function myfunc(abc As Integer) As Integer
myfunc = abc * 2
End Function

then call it somethng like:

p = myfunc(25) + 4
.



Relevant Pages

  • Re: Has anyone heard of "Girth Pain?"
    ... There are other MTs here who do their job the way you do. ... how to fix it, usually, but lord have mercy, I could have made $50 ... I think Jeannie was just saying that she would not want a sub who did ...
    (sci.med.transcription)
  • Re: Import data into seperate sheets
    ... but it is givin me an error '9' saying the ... script is out of range on the first line Sub open3_v2line: ... imported the data from the first file, but then it gave an error on the ...
    (microsoft.public.excel.programming)
  • Re: Worksheet Selection
    ... Sounds like you are wanting to use a UserForm. ... CommandButton, saying, "OK" ... Private Sub UserForm_Initialize ... > worksheets in a workbook and produce a list of these alphabetically. ...
    (microsoft.public.excel.programming)
  • Re: Late Binding Help please
    ... It is saying an Object is required. ... Dim ... Word Constants - to find out the value of any Word constant, ... Word's VBA and create a sub routine along these lines ...
    (microsoft.public.excel.programming)
  • Re: Arthrotec 75
    ... The sub was flagging it, Jeannie was fixing it, ... and the sub was then saying she couldn't work for someone who asked her to ... That something being Arthrotec 75 which does not ... Jeannie, if that sub cannot understand that, you're better off without the ...
    (sci.med.transcription)