+ Reply to Thread
Results 1 to 2 of 2

Copy data into a template based on criteria

  1. #1
    Registered User
    Join Date
    07-16-2013
    Location
    United States
    MS-Off Ver
    Excel 2003
    Posts
    4

    Copy data into a template based on criteria

    Hi Everyone,

    I'm a relative newbie with Excel macros, so please be gentle

    Here's what we need to do:

    We are compiling sheet 2 from another sheet of data (sheet 1) and I need to figure out how to put the data in the destination in a specific template format. For example:

    source data (sheet 1):

    Column A is the state
    Column B is the name of the country




    We have a column for each country in sheet 2

    Can we use a formula/macro to automatically copy column A from sheet 1 and and insert the data accordingly in sheet 2 under each country

    For example:

    sheet 1
    Column A Column B
    Ohio USA
    Virginia USA
    Goa India
    Karnataka India

    would appear in the sheet 2 as

    USA India
    Ohio Goa
    Virginia Karnataka

    I have about 208 countries in total and 300000 jurisdictions (column A) (total number of rows in sheet 1) and need a macro to create sheet 2 as per my requirement.

    I am totally new to macros and would help a code snippet.
    Any help is greatly appreciated.

    Input file (sheet 1)
    Macor.xlsx

    Thanks!
    Last edited by chandrsl; 07-16-2013 at 05:15 PM.

  2. #2
    Valued Forum Contributor
    Join Date
    03-22-2013
    Location
    Australia,NSW, Wirrimbi
    MS-Off Ver
    Excel 2013
    Posts
    1,057

    Re: Copy data into a template based on criteria

    Hi..

    Try this..
    Edit: I noticed the first version i posted was inserting the Country name in second row of each column.. fixed that in this edited code and attachment..

    Add this code to a CommandButton on your "Source" sheet..

    Please Login or Register  to view this content.
    Add this code into a Module..

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by apo; 07-17-2013 at 01:20 AM. Reason: Fixed bug..

+ 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: 11
    Last Post: 05-12-2013, 11:30 AM
  2. Copy data from one tab to other tab based on criteria
    By bombiro in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-12-2013, 01:26 PM
  3. Replies: 0
    Last Post: 12-10-2012, 01:02 PM
  4. Copying Data into Template based on Criteria
    By esphero in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-20-2012, 10:48 PM
  5. Copy data from a sheet to other based on a criteria
    By arun88aries in forum Excel General
    Replies: 5
    Last Post: 02-22-2011, 06:13 AM

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