+ Reply to Thread
Results 1 to 11 of 11

Stop Macro if Condition Met

  1. #1
    Spammer
    Join Date
    06-27-2013
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    183

    Stop Macro if Condition Met

    Hi Friends,

    I tried the belwo code to stop Macro if column "A" has the value "#NA" but i am getting error.
    {if the Value "#NA" not in the column "A" then macro can continue to run}

    Please Login or Register  to view this content.
    Kindly help to recitify the error.

  2. #2
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,697

    Re: Stop Macro if Condition Met

    Would this work?
    Please Login or Register  to view this content.
    Last edited by jolivanes; 04-27-2014 at 11:01 AM.

  3. #3
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Stop Macro if Condition Met

    This code should work,

    Please Login or Register  to view this content.
    Regards.
    Please consider:

    Be polite. Thank those who have helped you. Then Click on the star icon in the lower left part of the contributor's post and add Reputation. Cleaning up when you're done. If you are satisfied with the help you have received, then Please do Mark your thread [SOLVED] .

  4. #4
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Stop Macro if Condition Met

    jolivanes' Code could also work like this;

    Please Login or Register  to view this content.

  5. #5
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: Stop Macro if Condition Met

    Hi, prabhubox@yahoo.com,

    is it really #NA thatīs in the area?
    Please Login or Register  to view this content.
    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  6. #6
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Stop Macro if Condition Met

    @ HaHoBe,

    Hello Holger,

    Maybe with your code like this?

    Please Login or Register  to view this content.
    You always seem to come up with much better Code, and I think we should ban you from this Forum, just for that.LOL

    Kind Regards my Friend!

  7. #7
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: Stop Macro if Condition Met

    Hi, Winon,

    we would need to know if itīs an error returned from a function or a hard-coded value we are searching - code is okay for hard-coded values but Iīm afraid will not work on formulas where you would need to use a loop (according to the tiny bit of information provided: the code only).

    Ciao,
    Holger

  8. #8
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Stop Macro if Condition Met

    Hi Holger,

    Thanks for the feedback.

    You really are on your toes today, and very alert!

    It is a very valid point you are making, but I am pretty sure it relates to a Function error, and not hard coding.

    I guess we will have to wait for more clarification on this.


    Ciao

  9. #9
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: Stop Macro if Condition Met

    Hi, prabhubox,

    if itīs a formula/function you may try the following code

    Please Login or Register  to view this content.
    Ciao,
    Holger

  10. #10
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Stop Macro if Condition Met

    @ HaHoBe,

    Hello Holger,

    Wow!, What can I say?, but BRILLIANT!

    I "Hate" you

    Well done Friend!

    Kind regards.

  11. #11
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Stop Macro if Condition Met

    Hello prabhubox,


    Would you mind telling us which of the many solutions offered to you, solved your issue?

    It would also be good to know if you had an issue with #NA or #N/A.

    Thank you.

+ 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. Stop calculating based on condition
    By ryefield in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 09-13-2013, 07:41 AM
  2. Stop calculation once a condition is met
    By ryefield in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 08-01-2013, 07:30 PM
  3. STOP calculation after a condition has been met?
    By ryefield in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-01-2013, 07:24 PM
  4. Stop SUM of array on cell condition
    By uriavni in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-08-2013, 09:26 AM
  5. How to start and stop a loop base on condition.
    By Jwalker in forum Excel General
    Replies: 1
    Last Post: 08-30-2006, 12:13 AM

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