PC Review


Reply
Thread Tools Rate Thread

Debugging a function

 
 
=?Utf-8?B?aG1t?=
Guest
Posts: n/a
 
      5th Jul 2007
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.
 
Reply With Quote
 
 
 
 
=?Utf-8?B?Sm9lbA==?=
Guest
Posts: n/a
 
      5th Jul 2007
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
on cell with function. then click on formula box on top of worksheet (fx).
Press enter which makes excel thingks the cell is changing.

"hmm" wrote:

> 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.

 
Reply With Quote
 
Bob Phillips
Guest
Posts: n/a
 
      5th Jul 2007
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)

"hmm" <(E-Mail Removed)> wrote in message
news:5ADC2AB1-A1F7-4599-AD46-(E-Mail Removed)...
>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.



 
Reply With Quote
 
=?Utf-8?B?aG1t?=
Guest
Posts: n/a
 
      5th Jul 2007
Thanks Joel. I used the second option you gave and it works great.

"Joel" wrote:

> 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
> on cell with function. then click on formula box on top of worksheet (fx).
> Press enter which makes excel thingks the cell is changing.
>
> "hmm" wrote:
>
> > 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.

 
Reply With Quote
 
=?Utf-8?B?aG1t?=
Guest
Posts: n/a
 
      5th Jul 2007
Thanks Bob. Also works like a charm.

"Bob Phillips" wrote:

> 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)
>
> "hmm" <(E-Mail Removed)> wrote in message
> news:5ADC2AB1-A1F7-4599-AD46-(E-Mail Removed)...
> >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.

>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Debugging a function I Maycotte Microsoft Excel Programming 12 26th Jul 2006 08:55 PM
Block Step Into Debugging for a function rawCoder Microsoft Dot NET 2 8th Mar 2006 04:58 AM
Block Step Into Debugging for a function rawCoder Microsoft C# .NET 2 8th Mar 2006 04:58 AM
String function not working while debugging. archana Microsoft C# .NET 6 7th Feb 2006 08:09 AM
function names, debugging Josh Microsoft Dot NET Compact Framework 0 21st Jan 2004 06:13 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:47 PM.