+ Reply to Thread
Results 1 to 3 of 3

Help in Copy Header Colum data from one workbook to another

  1. #1
    Registered User
    Join Date
    01-06-2015
    Location
    Pacific Northwest
    MS-Off Ver
    2010
    Posts
    38

    Help in Copy Header Colum data from one workbook to another

    Hello,
    I have a bit of code from Alex P at another forum that works when sorting and ordering columns from one sheet to another sheet. You can order the columns any way you like on the target sheet and it will reorder the columns as you have laid them out with the proper column data being under your new header order. I would like to keep this part.
    I have two further requirements however.

    1. it seems this only works when the headers are on row 1 and I need to use header definitions on a different row and start from a different column on each.
    2. I need to get this to happen between two workbooks rather than worksheets on the same book.

    I could copy all the values from one book to a "Raw" sheet and look for the headers there copy / paste the needed columns then delete the Raw sheet entirely or for templates sake just clear the sheet and leave it blank if needed.
    Should this work without regard to the Header row range if properly defined in the sub? I am only looking for 3 matching columns of 25 - 30 columns.
    Here is the code that I have used and I know it works with headers on the same row 1 on both sheets.
    Please Login or Register  to view this content.
    TIA,
    Bud
    Last edited by Bud Wilkinson; 02-02-2015 at 04:46 PM.

  2. #2
    Registered User
    Join Date
    01-06-2015
    Location
    Pacific Northwest
    MS-Off Ver
    2010
    Posts
    38

    Re: Help in Copy Header Colum data from one workbook to another

    Ok so by changing the ".Cells(2, GetHeaderColumn(header.Value))" to ".Cells(4, GetHeaderColumn(header.Value))" I got the data to paste to the appropriate row. I am just not sure if there is an offset that can be changed to move the data from Column A to start on Column J.

    Here is where I'm at. I have tried modifying the offset values and the only one that seems to work is the passage outlined above. It is very close but now I am struggling to get the column data to paste under J3:L3 and when it does it blows out al the formatting in A4:C4.
    When Range(header.Offset(1, 0) sub values are changed it looks like it may work then just wipes out any formatting on those cells where I wish to paste it. Conditional formatting seems to remain when the data is pasted as values manually but all else is gone.
    If I try to add a value after ".Cells(4, -------- it gives an error.
    So I would like it to paste special values and move the data underneath the headers it found at J3;L3.
    Please Login or Register  to view this content.
    TIA,
    Bud
    Last edited by Bud Wilkinson; 02-02-2015 at 05:44 PM.

  3. #3
    Registered User
    Join Date
    01-06-2015
    Location
    Pacific Northwest
    MS-Off Ver
    2010
    Posts
    38

    Re: Help in Copy Header Colum data from one workbook to another

    Well I still need help with this. I found the way to get the data to paste to the appropriate row and column by doing the following.
    ".Cells(4,9+ GetHeaderColumn(header.Value))"
    What is still throwing me is to get the code to paste values and leave the cell formatting and conditional formatting at the "Destination" worksheet line.
    Please Login or Register  to view this content.
    Please I still need help. I would love it if this could be run on Dim openWb As Workbook, and openWb.Sheets("Raw") to match the column in and pull the column values from a different workbook.
    Anyone?

    Bud

+ 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. Copy data from header to header in consolidation sheet
    By Ignesh in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 11-12-2013, 04:10 AM
  2. need a macro if row is text is constant then other colum shd copy n paste in other colum
    By uttam.mothe in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-05-2013, 12:17 PM
  3. Copy paste last row from each workbook in master workbook on header criteria
    By farrukh in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-30-2013, 07:28 AM
  4. copy and paste colum K to colom R and skip filled cells colum R
    By jdrmer in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-13-2012, 10:30 AM
  5. copy data from row across to colum down
    By stevene123 in forum Excel General
    Replies: 1
    Last Post: 03-21-2007, 05:37 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