+ Reply to Thread
Results 1 to 6 of 6

VBA that pastes from data dump and formats any excess cells depending on how man cells

  1. #1
    Registered User
    Join Date
    02-28-2018
    Location
    Edinburgh
    MS-Off Ver
    2016
    Posts
    12

    VBA that pastes from data dump and formats any excess cells depending on how man cells

    Hi there,

    I wondering if someone can help me with a code that copy and pastes the data into the other sheets matching column. However as with doing this is there a way to reduce or extend the formatting of the table in the first sheet.

    I've attached a crude example that only has a new dump with only 8 rows , thus the full table should be ruduced to the corresponding row in the on the new sheet or if there is more project numbers that the table is increased to match the amount.

    Basically I have a sheet that runs off VLOOKUPS that use the project ID number however it runs infinitely down the column as =queryA:A, and I want a VBA code that can copy the amount of ID numbers everytime the query is updated and changed/reduced whilst also copying the VLOOKUP Formulas or up or down if necessary.

    Any help would be hugely appreciated.

    Thanks All
    Attached Files Attached Files

  2. #2
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: VBA that pastes from data dump and formats any excess cells depending on how man cells

    I don't understand the requirement. Are you looking for something to read the data on Query Dump and append it to Sheet 1?
    One spreadsheet to rule them all. One spreadsheet to find them. One spreadsheet to bring them all and at corporate, bind them.

    A picture is worth a thousand words, but a sample spreadsheet is more likely to be worked on.

  3. #3
    Registered User
    Join Date
    02-28-2018
    Location
    Edinburgh
    MS-Off Ver
    2016
    Posts
    12

    Re: VBA that pastes from data dump and formats any excess cells depending on how man cells

    Sorry I will try explain,

    Basically sheet 1 gets its Project ID(1st Column from the Query Dump 1st Column). Once this has been established every other column on sheet 1 runs a VLOOKUP from these numbers. My question is , is it possible to have a macro attached to a button that when clicked, can copy and paste the Project ID from the Query Dump into sheet 1 (1st Column) and then from that , determine if there is more or less numbers than the previous paste and thus extend/reduce the other columns formulas & Formatting of Sheet 1s Table.

  4. #4
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: VBA that pastes from data dump and formats any excess cells depending on how man cells

    OK, the way I am reading this is that you want to REPLACE the old data with the new.

  5. #5
    Registered User
    Join Date
    02-28-2018
    Location
    Edinburgh
    MS-Off Ver
    2016
    Posts
    12

    Re: VBA that pastes from data dump and formats any excess cells depending on how man cells

    Yes, everytime I refresh the query dump there may be a greater or less amount of Project IDs. Instead of physically having to extend sheet1s table formatting/formulas.I was the code to run down the query dump and copy the amount of Project IDs then paste into sheet1. Then the code should either extend or reduce each column within the sheet1 table.See attached it basically shows the crude function of how my table uses VLOOKUP based upon the Project ID numbers.
    Attached Files Attached Files

  6. #6
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: VBA that pastes from data dump and formats any excess cells depending on how man cells

    This workbook makes use of Excel Tables. I converted the data range on the project sheets to an excel table. One of the features of an excel table is that it preserves all formatting, formulas, validations, etc. as data is copied in. Tables also know how big they are, so formulas and pivot tables that are built from them are dynamic as you add or delete data. You can also reference tables by their parts, such as the header, total row, data body or use column headers as parts of formulas or VB code.

    Here is more information on tables: http://www.utteraccess.com/wiki/Tables_in_Excel.

    Here is the code that does the magic. There isn't much to it.
    Please Login or Register  to view this content.
    The ClearTable function is in its own module. It is fairly standard code that I use all the time. It checks to see if there is a filter on the table and resets it, and then removes all table data.
    Attached Files Attached Files

+ 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 to delete excess cells at the bottom?
    By blanko in forum Excel General
    Replies: 5
    Last Post: 07-14-2017, 03:20 AM
  2. Replies: 2
    Last Post: 11-20-2016, 03:07 PM
  3. Problem figureing out how to dump data and set cells to 0
    By naturaldissolve in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 09-05-2016, 03:43 PM
  4. Excess of Empty Cells
    By bachman187 in forum Excel General
    Replies: 4
    Last Post: 07-20-2016, 12:55 PM
  5. Cells & tables formats depending on another cell content
    By ThomassoCZ in forum Excel General
    Replies: 1
    Last Post: 12-17-2014, 10:56 AM
  6. Replies: 3
    Last Post: 05-30-2014, 01:15 PM
  7. [SOLVED] Auto populate cells depending on data in other cells
    By Drunknmonkie in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 11-06-2013, 11:46 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