+ Reply to Thread
Results 1 to 2 of 2

VBA to Copy Data from one Workbook to Another by Column Name

  1. #1
    Registered User
    Join Date
    04-04-2013
    Location
    Philadelphia, PA
    MS-Off Ver
    Excel 2010
    Posts
    1

    VBA to Copy Data from one Workbook to Another by Column Name

    Hi everyone. I'm looking for help creating a macro that will look for data in a column based on its header name (i.e. "Site"), and copy and paste it into a new workbook with a Different Header Name (i.e. "Site Name") in potentially a different column order. So essentially the searching and copying and pasting is solely based on the column header name.

    I already have code that will create my new "formatted" workbook and set up the new columns, so I just need excel to return to the other "raw" workbook, grab the data, and return to the "formatted" workbook to drop the data into the right column. I am new to VBA and while I can work with macros, I'm not very good at writing code yet.

    My overall goal is taking raw data from a workbook and creating a new formatted workbook that always looks the same for import into a database. Is what I have described the best way to do it?? Any help would be greatly appreciated!

    Thanks,
    James

  2. #2
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: VBA to Copy Data from one Workbook to Another by Column Name

    Hi James,

    Perhaps the most efficient way is to create a user defined type as your "formatted" record and then load your type from the headings (or positionings) in each of the field (raw) data inputs. Check out my website (xladept.com) the PEUData and MasterPEU list - I think the Load module
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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