+ Reply to Thread
Results 1 to 2 of 2

Copy range to multiple sheets based on criteria with lookup

  1. #1
    Registered User
    Join Date
    08-29-2017
    Location
    Edinburgh, Scotland
    MS-Off Ver
    2016
    Posts
    12

    Copy range to multiple sheets based on criteria with lookup

    Hello all,

    I have an API call that pulls data relating to 34 individual sites. Each site has a varying number of assets within it, each with a unique identifier.

    I am trying to write a macro that will copy and paste the data for specific sites into their own individual worksheet within the file. The basic concept of this I am familiar with and am sure I could usually manage something using auto filter.

    The problem I am hitting however is that the API call pulls out a different unique asset identifier compared to what I use for reporting.

    What I mean by this is that each asset has a unique name for example ACH_WTG01, ACH_WTG02 etc, but they also have a unique number assigned to them for storing in the database that I am pulling the data from.

    So ACH_WTG01 also has unique number reference 48 and ACH_WTG02 has number reference 49 and so on.

    I would usually use a VLookup to display the data with the more easily understandable asset name rather than the number reference, but I am struggling to figure out how to do this within a macro.


    I have attached a demo copy of the sheet I will be using that shows the raw data as it comes out after I run the API call, along with the sheet that I would use for the VLookup reference and a couple of the sheets I want to copy the data into.

    My questions are:

    1. Is it possible using a Macro to lookup the Asset ID and then copy and paste the site specific data from that range in Raw Data into the individual site sheets but to also display the Asset Name rather than the ID number?

    2. Can this be done using the Sheet name which is the Site Abbreviation, or would I need to have a reference cell within each of the individual site sheets?

    Apologies in advance if my explanation is not very clear. I have very limited experience using macros so I am not sure if my way of explaining what I want to achieve is understandable or if at all possible.
    I am very keen to learn however and any guidance you fine folk could offer would be very much appreciated.

    Thanks in advance!
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    08-29-2017
    Location
    Edinburgh, Scotland
    MS-Off Ver
    2016
    Posts
    12

    Re: Copy range to multiple sheets based on criteria with lookup

    Hello again.

    I've just realised I can merge tables into my API Query so have managed to bypass the need to lookup or replace any values in the macro script.

    All I need to do now is script out the macro to copy and paste the data into the relevant sheets.

+ 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] VBA to Lookup, Copy and Paste Multiple Cells From a Row, Based On 2 Criteria
    By KaneBlaisdell in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-28-2019, 02:37 PM
  2. Copy Rows from multiple sheets into one based on criteria
    By jh51745 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-18-2016, 09:05 PM
  3. Sum Across a Variable Range of Sheets Based on Multiple Criteria
    By jpinho88 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 01-06-2015, 04:28 PM
  4. [SOLVED] Lookup value based on date range and multiple criteria
    By jsclark in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 02-07-2014, 06:23 PM
  5. [SOLVED] Lookup and sum multiple values based on a single criteria in multiple sheets.
    By paulsanett in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-17-2014, 12:18 PM
  6. Search multiple sheets for value based on criteria and copy data accordingly
    By Zagadka in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-31-2012, 08:46 AM
  7. Copy data from multiple sheets based on certain criteria!!
    By missyk77 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 08-24-2010, 12: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