+ Reply to Thread
Results 1 to 8 of 8

Run Macro upon cell changed by formula

  1. #1
    Registered User
    Join Date
    11-20-2007
    Posts
    4

    Run Macro upon cell changed by formula

    Hello, I'm trying to run a macro, using Visual Basic, upon the change of a cell which is based on a formula. I know the worksheet_change function only evaluates manually inputted data values and not data updated by a formula. Any help would be greatly appreciated and thanks in advance.

  2. #2
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Right click the sheet name and enter the below. Then in a normal module add your macro. Change
    Please Login or Register  to view this content.
    to your name

    Please Login or Register  to view this content.
    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  3. #3
    Registered User
    Join Date
    11-20-2007
    Posts
    4
    I added your code to the view code page on the sheet and changed the cell to c3(where the BLP formula is) and have made a macro called "Macro1" and replaced it where you wrote "yourmacroname". Macro 1 simply outputs a msgbox but it does not execute upon the data change in cell c3. I don't know if this is important but cell c3 is a blp function streaming in live RTD data. Am i doing something wrong? I'm quite a noob at Visual basic so any extra detail you could provide would be greatly appreciated. Thanks, Dennis.

  4. #4
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    See if this examples helps.

    blp function streaming in live RTD data
    Not sure if it works for streaming. Did you change the criteria for running the macro ??

    VBA Noob
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    11-20-2007
    Posts
    4
    Thanks for your sheet. It works well for regular formulas but doesn't seem to work for streaming data that updates itself.

  6. #6
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983
    Formulas do not trigger the Worksheet_Change macros
    You will need to use a Worksheet_Calculate macro
    Please Read Forum Rules Before Posting
    Wrap VBA code by selecting the code and clicking the # icon or Read This
    How To Cross Post politely

    Top Excel links for beginners to Experts

    If you are pleased with a member's answer then use the Scales icon to rate it
    If my reply has assisted or failed to assist you I welcome your Feedback.

  7. #7
    Registered User
    Join Date
    11-20-2007
    Posts
    4
    I tried using the Worksheet_Calculate function in place of the worksheet_Change function but am having problems. Where in the code do I place the worksheet_calculate function? I tried to replace the change with calculate. Sorry for being such a noob. I'm using the attached file above. Thanks, Dennis.

  8. #8
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983
    Because does not have any details pased to it you need to code in a differnet way to the Worksheet_Change macros


    This goes on the same sheet & replaces the existing Worksheet_Change macro
    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1