Consulting

Results 1 to 9 of 9

Thread: Problem with UDF

  1. #1

    Problem with UDF

    I have a bunch of UDFs in my spreadsheet. When I'm debuging my code they recalculate a bunch of times. Is there a way to prevent my editor from stepping through that part of the code?

  2. #2
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,877
    tA couple of things I do; if the calculations aren't important to the debugging of the current vba development and the functions end up being called a lot, I change the name of those funcions by adding a 'x' or two.
    You could try setting calculation to manual.
    If it is vital the udf code is executed then when you find yourself stepped into such a function, Ctrl+Shift+F8 gets you back to your debugging code.
    You can also step through you code in jumps by putting the cursor on where you want the code next to stop and pressing Ctrl+F8 (or putting a break point there, or even a Stop instruction in he code)
    p45cal
    Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

  3. #3
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    When debugging, rather than Step Into (F8), Step Over (Shift-F8).
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  4. #4
    Thank you for the assistance. The ctrl+f8 and ctrl+shft+f8 is something that I did not know about. I currently just write a stop instruction like you suggest. So I take it that there is no way to ignore stepping through certain pieces of code that you write, like an excel function? Like a tag that tells the editor to just ignore stepping through a certain piece of code?

  5. #5
    Password protecting a module would have been my guess, but i don't know how to protect just one module.

  6. #6
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Shift-F8 steps over it as I said, It still gets executed, you just don't step through it.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  7. #7
    Mac Moderator VBAX Guru mikerickson's Avatar
    Joined
    May 2007
    Location
    Davis CA
    Posts
    2,778
    When debugging, I find the RunToCursor option useful for running subroutines without stepping through each line.

  8. #8
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Debug.Assert is also very useful, I use it all the time, because it is conditional.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  9. #9
    Hey, I found an interesting way to solve this problem.

    [VBA]
    Application.enableevents = false

    application.enableevents = true
    [/VBA]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •