+ Reply to Thread
Results 1 to 2 of 2

VBA to copy and remove index/match formulas

  1. #1
    Registered User
    Join Date
    06-10-2016
    Location
    Orlando, FL
    MS-Off Ver
    2013
    Posts
    2

    VBA to copy and remove index/match formulas

    I have a workbook with three tabs, NEUT, WORK and DBASE. *I work in the WORK tab which uses INDEX/MATCH functions to pull information from the database. *When I have a file completed I need to remove the index/match functions and leave the other formulas performing various calculations. I currently save the file as neutralized and copy and paste values for each column with the index/match formula. The columns with INDEX/Match are B:E,G,J,L,N,P,AA;BE. I added the NEUT tab and thought I could copy information from the WORK tab with all of the formatting and then remove the INDEX/MATCH functions by copy and paste value. This will allow me to make revisions to the file and just run the macro. I recorded a macro and it works but I have some issues I don't know how to fix. These tabs can have over 5,000 rows and the current macro only works on the delimited rows I selected.

    1. Macro needs to automatically add rows to NEUT tab to accommodate WORK tab # rows. (May be able to copy and insert from WORK tab, this would eliminate issue with # rows on NEUT tab).
    2. Macro needs to automatically find the End of the WORK tab.

    If I can get this to work smoothly I will not need to have multiple files for one project and it will save a lot of time.*Since the WORK tab gets updated often I will need to be able to run this macro often. I labeled a cell in "A:A" below the totals, "0" that is a blank row with all formula and formatting. I also labeled a cell in "A:A" at the totals "END"

    CURRENT MACRO STEPS:
    1. NEUT TAB: Copy row 30 and Insert enough rows to match WORK tab # rows.
    2. Copy row 30 and paste over existing rows to clear information.
    3. Copy all data from WORK tab from row 10 to "END-2".
    4. Delete extra rows at bottom of NEUT tab from last data to "END-2")
    5. Copy columns B:E,G,J,L,N,P,AA;BE with INDEX/MATCH and paste as value.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: VBA to copy and remove index/match formulas

    Hi Guestimator,

    Thank you for the excellent presentation of your problem. I may be missing something, but I don't think Row 30 on Sheet 'Neut' is needed.

    Try the following code, which is in the attached copy of your file:
    Please Login or Register  to view this content.
    To prevent typos from ruining days and weeks of work 'Option Explicit' is NEEDED at the top of each code module. This prevents errors caused by missspellings and FORCES every variable to be DECLARED (e.g. Dim i as Integer). https://www.excel-easy.com/vba/examp...-explicit.html

    Debugger Secrets:
    a. Press 'F8' to single step (goes into subroutines and functions).
    b. Press SHIFT 'F8' to single step OVER subroutines and functions.
    c. Press CTRL 'F8' to stop at the line where the cursor is.
    d. 'Left Click' the margin to the left of a line to set (or clear) a BREAKPOINT.
    e. Press CTRL 'G' to open the IMMEDIATE WINDOW. 'debug.print' statements send their
    output to the IMMEDIATE WINDOW.
    f. Select View > Locals to see all variables while debugging.
    g. To automatically set a BREAKPOINT at a certain location put in the line:
    'Debug.Assert False'
    h. To conditionally set a BREAKPOINT at a certain location put in lines similar to:
    if i >= 20 and xTV20 > 99.56 then
    Debug.Assert False
    endif
    i. A variable value will be displayed by putting the cursor over the variable name.

    To manually set a breakpoint, see http://www.wiseowl.co.uk/blog/s196/breakpoints.htm

    Lewis

+ 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] index match remove duplicates
    By sick stigma in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 03-26-2015, 12:22 PM
  2. [SOLVED] Combining 3 Formulas: Return all Names that Match Criteria Using Index/Match
    By bchilme in forum Excel Formulas & Functions
    Replies: 20
    Last Post: 09-29-2014, 09:28 AM
  3. Index Match from two columns and Remove duplicates,
    By gurkovic in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 07-16-2014, 05:18 AM
  4. Remove #N/A if index(match Value
    By hkbhansali in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 03-09-2014, 10:31 AM
  5. [SOLVED] Remove #N/A from Index Match - quick help
    By cgainer in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-26-2013, 03:36 PM
  6. Remove #N/A from IF statement with INDEX & MATCH
    By usc1382 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 07-11-2013, 01:21 PM
  7. [SOLVED] Remove zero's and N/A's from my Index match formula
    By cgainer in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 05-01-2013, 10:39 AM

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