+ Reply to Thread
Results 1 to 7 of 7

Macro to Clear Row Based on Formula Value

  1. #1
    Registered User
    Join Date
    08-02-2017
    Location
    ny
    MS-Off Ver
    2013
    Posts
    20

    Macro to Clear Row Based on Formula Value

    I am working on a sheet where I have a bunch of formulas in columns A1-K500. Here is what I am trying to accomplish:

    If the formula in cell A1 (or A2, A3, etc) returns a "0" then I want the cell contents in A1 thru K1 to be cleared. If it does not return a 0 then the row should be left alone. This needs to happen for about 500 rows or so.

    Is there a Macro for this? I was able to figure out how to hide the row if A1 is 0 but for formatting purposes, I need to leave the rows visible on the sheet.

    Thanks!


  2. #2
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: Macro to Clear Row Based on Formula Value

    Something like (untested)

    Please Login or Register  to view this content.
    Last edited by kev_; 08-03-2017 at 07:51 AM.
    Click *Add Reputation to thank those who helped you. Ask if anything is not clear

  3. #3
    Registered User
    Join Date
    08-02-2017
    Location
    ny
    MS-Off Ver
    2013
    Posts
    20

    Re: Macro to Clear Row Based on Formula Value

    Hmm, if I copy that code exactly, it is not working. Thanks for your response though!

  4. #4
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Macro to Clear Row Based on Formula Value

    Try:

    Please Login or Register  to view this content.

  5. #5
    Valued Forum Contributor
    Join Date
    04-24-2014
    Location
    United States
    MS-Off Ver
    Office 365 ProPlus
    Posts
    853

    Re: Macro to Clear Row Based on Formula Value

    Just a note that based on your original post, you indicated if the formula = 0, you want to clear the row including the formula? So the formula is erased as well?

  6. #6
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Macro to Clear Row Based on Formula Value

    @ptmuldoon - Good question.

  7. #7
    Registered User
    Join Date
    08-02-2017
    Location
    ny
    MS-Off Ver
    2013
    Posts
    20

    Re: Macro to Clear Row Based on Formula Value

    Yes, I need everything to erase, including the formulas. I found this on another thread and I think it is working.



    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)

Similar Threads

  1. [SOLVED] I need a macro to clear cells based on contents
    By emymeeky in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 12-28-2013, 08:54 AM
  2. Macro to clear cells based on project status
    By Sassyponypants in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 11-19-2013, 08:36 AM
  3. Replies: 1
    Last Post: 06-21-2013, 04:05 AM
  4. Help adapting a macro to clear cells based on a date
    By nje in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-06-2013, 06:20 PM
  5. [SOLVED] Macro to clear contents based on specific criteria
    By greggatz in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-28-2012, 10:26 AM
  6. Clear rows based on conditional formula
    By jman0707 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-04-2008, 12:07 PM
  7. Formula to clear cells based on another cell value
    By mrdata in forum Excel General
    Replies: 2
    Last Post: 02-22-2008, 05:58 AM
  8. Clear Cell based on event w/o macro?
    By Paul987 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-27-2005, 03:44 PM

Tags for this Thread

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