+ Reply to Thread
Results 1 to 8 of 8

Code for applying same change to range of existing formulas

  1. #1
    Registered User
    Join Date
    07-27-2015
    Location
    Canada
    MS-Off Ver
    15.0.4
    Posts
    33

    Code for applying same change to range of existing formulas

    I'd like to create a code that finds all "NA" values in my existing formulas, and replaces them with "'-"

    I recorded a macros, where I erased NA and replaced with '-, which runs perfectly on a one-by-one scale. I also recorded a macros of this change to an entire row of my data, and this macros runs fine if I run the code on a line by line basis. If I highlight a larger range, it will revert the formula to the row that I originally selected. This would be fine, however it would still be highly time consuming over the course of my existing data.

    Looking forward to your comments.

    Thank you!

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

    Re: Code for applying same change to range of existing formulas

    What about just modifying your formula to use IFERROR?

  3. #3
    Registered User
    Join Date
    07-27-2015
    Location
    Canada
    MS-Off Ver
    15.0.4
    Posts
    33

    Re: Code for applying same change to range of existing formulas

    Looks like my last reply didn't go through!

    Pardon the duplicate if it loads up in a few.

    I'm trying to find a streamlined way to modify about 12,000 existing IF formulas, where the "value if false" is "NA". I am trying to change the "value if false" to '-

    Thank you

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

    Re: Code for applying same change to range of existing formulas

    Can you post the existing if formula? Are they the same formula's just copied down/across multiple sheets? Or various, multi condition?

    If you can give a sample or example, it will help.

  5. #5
    Registered User
    Join Date
    07-27-2015
    Location
    Canada
    MS-Off Ver
    15.0.4
    Posts
    33

    Re: Code for applying same change to range of existing formulas

    Found the world's best solution: Find NA and replace all with -

    All the best

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

    Re: Code for applying same change to range of existing formulas

    Can you post the existing if formula? Are they the same formula's just copied down/across multiple sheets? Or various, multi condition?

    If you can give a sample or example, it will help.

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

    Re: Code for applying same change to range of existing formulas

    Quote Originally Posted by MontrealMTL View Post
    Found the world's best solution: Find NA and replace all with -

    All the best
    Are you sure that's what you wanted to do though? After doing a find and replace, didn't you just lose the formula you had there? What happens if the spreadsheet is updated?

  8. #8
    Forum Contributor
    Join Date
    08-07-2015
    Location
    AB, Canada
    MS-Off Ver
    Excel 2013 x64
    Posts
    132

    Re: Code for applying same change to range of existing formulas

    I understand the Find and Replace method works reasonably well if you want to replace EVERY "NA" on the entire worksheet. I always get a little worried when using a find/replace with a string as generic as "NA".

    Here's a piece of code that will replace "NA" with "-" in only the cells you have selected when you choose to run the macro. Hope this helps!

    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. how change the existing vba code to another workbook
    By Natalie2 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-18-2014, 03:42 PM
  2. [SOLVED] Altering existing formulas using VBA code
    By TheRobsterUK in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-14-2014, 11:35 AM
  3. retroactively applying formulas to existing data
    By jacquelineb in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-06-2013, 10:01 AM
  4. [SOLVED] VB Code help to change/update existing code
    By JDobbsy1987 in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 10-24-2013, 04:46 PM
  5. [SOLVED] Need a code or formula that will automatically change the named range in my formulas
    By mo4391 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-28-2013, 11:24 AM
  6. applying macro code to a range of cells
    By just-gal in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-31-2009, 02:26 PM
  7. VBA code to change registry value of existing DSN
    By Alan in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-18-2005, 04: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