+ Reply to Thread
Results 1 to 2 of 2

Calling a macro where cell value is equal but only run once

  1. #1
    Forum Contributor
    Join Date
    04-21-2009
    Location
    England
    MS-Off Ver
    Excel 2016
    Posts
    710

    Calling a macro where cell value is equal but only run once

    Hi all, I have some code that calls a macro where cell W4 equals 1.

    It works fine, the problem is it gets stuck in a loop and keeps running the macro as cell W4 remains 1.

    Cell W4 is a formula so I don't want to delete the cell contents, I just want the macro to trigger once if possible

    My code is below

    Please Login or Register  to view this content.

  2. #2
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,444

    Re: Calling a macro where cell value is equal but only run once

    Hi,

    I guess W4 changes to 1 because of a change in another cell? Let's say that cell is A1.

    You could change your macro to check if A1 is what triggered the Worksheet_Change event and if the value of W4 is 1, and only then run the macro.

    Please Login or Register  to view this content.
    Rule 1: Never merge cells
    Rule 2: See rule 1

    "Tomorrow I'm going to be famous. All I need is a tennis racket and a hat".

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Calling Macro from cell selection
    By dkatorza in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-10-2014, 07:26 AM
  2. [SOLVED] calling a macro on cell change
    By deek in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-07-2014, 04:17 PM
  3. VBA on calling a Macro via a specfic cell value
    By gpeacock1981 in forum Excel General
    Replies: 0
    Last Post: 12-07-2010, 11:44 AM
  4. Calling a Macro from a cell
    By sach0025 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-10-2007, 03:42 PM
  5. Replies: 2
    Last Post: 08-29-2006, 04:42 AM
  6. Calling macro on cell change
    By schoujar in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-26-2005, 03:57 AM
  7. [SOLVED] When calling a different file, can I make the tab equal to a cell?
    By thebigd08 in forum Excel General
    Replies: 1
    Last Post: 06-23-2005, 08:05 PM

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