+ Reply to Thread
Results 1 to 3 of 3

Code to copy data to another workbook using headers

  1. #1
    Registered User
    Join Date
    12-02-2012
    Location
    Perth
    MS-Off Ver
    Excel 2007
    Posts
    8

    Code to copy data to another workbook using headers

    Hi,

    My skills with VBA at the moment are pretty basic and I’d like a bit of help to get started writing the code.

    I have a report (WBK1.xlsx) with 14 different headers in row 2. They can be named Header1, Header 2 etc. I can change them manually later if needed.

    The second spreadsheet (WBK2.xlsx) in my documents folder has the only some of the same headers in row 10. I want to write a macro that will copy the rows with data from WBK1, open WBK2 and then paste to WBK 2 row 12 where the headers match. This is where I fall when using the recorder.

    There are two columns called ‘Debit’ and ‘Credit’ where I would like to paste as values.

    If someone could help me get a start I would greatly appreciate it.

    Thanks,
    DB

  2. #2
    Valued Forum Contributor
    Join Date
    11-02-2012
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003, 2007, 2010
    Posts
    564

    Re: Code to copy data to another workbook using headers

    Please upload workbooks you are referring to. It will be easy working on them for us.

  3. #3
    Registered User
    Join Date
    12-02-2012
    Location
    Perth
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Code to copy data to another workbook using headers

    Tried again and it let me. I've just put generic data in.

    I want to take the data from row 3 wbk1 and paste to row 12 wbk2 where the headers match. Ideally I'd prefer to leave out the lines with Journal1-Journal4 and the totals at the end. the number of rows will change month to month however
    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)

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