Consulting

Results 1 to 2 of 2

Thread: 'Application.Volatile True' question

  1. #1
    Administrator
    2nd VP-Knowledge Base
    VBAX Master malik641's Avatar
    Joined
    Jul 2005
    Location
    Florida baby!
    Posts
    1,533
    Location

    'Application.Volatile True' question

    When I use the
    Application.Volatile True
    method for my function, I noticed that the MsgBox's that I have for the function appear in the other workbook(s) when I make a change in a worksheet. Why?

    In my function the MsgBox's are in a FOR-NEXT loop, but my loop is as stated:

    ]For Each cmt In Application.Caller.Parent.Comments
    'Code
    Next cmt
    The MsgBox is within an IF statement and is looped (if that matters ) to repeat different values for the function I'm debugging.

    How can I stop this??




    New to the forum? Check out our Introductions section to get to know some of the members here. Feel free to tell us a little about yourself as well.

  2. #2
    Site Admin
    Urban Myth
    VBAX Guru
    Joined
    May 2004
    Location
    Oregon, United States
    Posts
    4,940
    Location
    I'd read up on the Volatile method in the VBA help files. Basically, that means that any time any change is made in any open workbook, that cell will be calculated, no matter what. Similar (native) functions include TODAY, RAND, NOW, OFFSET*. They will behave the same way.

    *The OFFSET function is a volatile function, although not origially designed that way, it is an error (acknowledged by MS) in the coding and will probably be fixed in newer versions of Excel (I would suspect anyway).

Posting Permissions

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