+ Reply to Thread
Results 1 to 3 of 3

Maintaining Formula when Deleting Reference Cells via VBA Macro

  1. #1
    Forum Contributor
    Join Date
    12-09-2015
    Location
    Virginia, USA
    MS-Off Ver
    2007
    Posts
    121

    Maintaining Formula when Deleting Reference Cells via VBA Macro

    I am trying to populate four rows with data from my "records" sheet, but am having trouble mainting the formulas when I run a macro that deletes old record files and replaces with a new one. I got the following formula to work, but then it returns #na after the macro is run because the original reference cells were deleted. My other issue is that the formula I am using, won't really work for when there may only be 3 records since it isn't rematching the lookup value (i.e. it is taking whatever the 3rd row is below the first matched cell).

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    I've tried to lock in the refernce by putting the absolute value signs on it, but to no avail...

    Any help would be greatly appreciated!

  2. #2
    Forum Contributor
    Join Date
    12-09-2015
    Location
    Virginia, USA
    MS-Off Ver
    2007
    Posts
    121

    Re: Maintaining Formula when Deleting Reference Cells via VBA Macro

    Posted prematurely. Here are the cells that I'd like to maintain their formulas even when the reference cells get deleted.

    A7
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    A8
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    A9
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    A10
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    After I run the macro, all the Records!$A$1 change to Records!$B$1 and when I try to type in the original formula, I can't get it to return the right values anymore...

  3. #3
    Forum Contributor
    Join Date
    12-09-2015
    Location
    Virginia, USA
    MS-Off Ver
    2007
    Posts
    121

    Re: Maintaining Formula when Deleting Reference Cells via VBA Macro

    I was able to write the formula into VBA to get this to work, but it would be helpful to not waste time/steps in vba writing those formulas. Ideally, I'd be able to have the formula set in the sheet and just have it updated with the new records file.
    Last edited by rjj920; 01-15-2018 at 05:25 PM.

+ 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. Replies: 0
    Last Post: 05-30-2017, 08:01 AM
  2. Replies: 4
    Last Post: 11-01-2014, 06:11 PM
  3. [SOLVED] Adding & Deleting Rows in Worksheet while maintaining Formulas
    By moosetales in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 03-27-2014, 07:22 AM
  4. Inserting and Deleting rows while maintaining formula consistency
    By ChaeDoc in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-16-2013, 05:42 AM
  5. Excel 2007 : Deleting Duplicates WHILE maintaining additional columns
    By bioinformatics_guy in forum Excel General
    Replies: 0
    Last Post: 03-02-2011, 12:56 PM
  6. Replies: 1
    Last Post: 07-23-2009, 05:38 PM
  7. Pivot Table - Deleting data rows while maintaining them in the tot
    By Robert Hamilton in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 06-07-2006, 02:45 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