ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to Debug User Defined Functions (https://www.excelbanter.com/excel-programming/388105-how-debug-user-defined-functions.html)

Kieranz[_2_]

How to Debug User Defined Functions
 
Hi All,
I have written a user defined function but when i go to VBE and press
F8 to step thru the code it does not work. I have gone on many
websites but most seem to show you how to create, not after... like
debug. Any help or website referral appreciated. Thks.
Rgds
KZ


Norman Jones

How to Debug User Defined Functions
 
Hi Kieranz,

To step through the function's code, try inserting break
points in the function code and then insert a new instance of
the function in the worksheet.


---
Regards,
Norman



"Kieranz" wrote in message
ups.com...
Hi All,
I have written a user defined function but when i go to VBE and press
F8 to step thru the code it does not work. I have gone on many
websites but most seem to show you how to create, not after... like
debug. Any help or website referral appreciated. Thks.
Rgds
KZ




Charles Williams

How to Debug User Defined Functions
 
select the first line in the function and press F9 to set a breakpoint

Then go to the Excel screen and cause a calculation that calls the the UDF

Charles
______________________
Decision Models
FastExcel 2.3 now available
Name Manager 4.0 now available
www.DecisionModels.com

"Kieranz" wrote in message
ups.com...
Hi All,
I have written a user defined function but when i go to VBE and press
F8 to step thru the code it does not work. I have gone on many
websites but most seem to show you how to create, not after... like
debug. Any help or website referral appreciated. Thks.
Rgds
KZ




Halim

How to Debug User Defined Functions
 
Hi Kieranz,

Just a little explain...:
you can debuging this directly by pressing F8 in this function:
Function FuncA()
FuncA = "AA"
Debug.Print FuncA
End Function

But not for this:
Function FuncB(Str As String) As String
FuncB = Str
Debug.Print FuncB
End Function

you have to use sub to call FuncB:
Sub TesFunction()
Call FuncB("BB")
End Sub


--

Regards,

Halim


"Kieranz" wrote:

Hi All,
I have written a user defined function but when i go to VBE and press
F8 to step thru the code it does not work. I have gone on many
websites but most seem to show you how to create, not after... like
debug. Any help or website referral appreciated. Thks.
Rgds
KZ



LEO@KCC

How to Debug User Defined Functions
 
You cannot enter into "break-mode" for sub or function procedures that
require mandatory arguments. The trick is to set a break point in the
function and call the function from another macro.
Leo
"Kieranz" wrote in message
ups.com...
Hi All,
I have written a user defined function but when i go to VBE and press
F8 to step thru the code it does not work. I have gone on many
websites but most seem to show you how to create, not after... like
debug. Any help or website referral appreciated. Thks.
Rgds
KZ





All times are GMT +1. The time now is 01:36 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com