Debugging a function

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have used the debugger to go step by step through a subroutine, but I have
not succeeded in doing so for a function. I suspect this is because the
function does not know where to call its argument values from.

Is there any way to include the arguments in cells, or call the function
from a cell, and then step through with the debugger? Any insights
appreciated.
 
I do it one of two ways

1) create a subroutine test with no parameters. the call the function from
Test

sub Test()

set myrange = Range("A1:B22")
call myfunction(myrange)

end sub

function myfunction(target as range)


end function

2) Put break on first line of function. Then code to spreadsheet and click
 
Call it from the immediate window and pass the parameters, like so

?myFunction(num1,"text2")

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)
 
Thanks Bob. Also works like a charm.

Bob Phillips said:
Call it from the immediate window and pass the parameters, like so

?myFunction(num1,"text2")

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Macro statement won't execute 10
VBA Debug Issue 2
Help with debugging 4
User defined function 5
How Can I Boost My GPU Performance with MSI Afterburner? 0
Debugging 1
General debugging question 4
Excel VBA 1

Back
Top