+ Reply to Thread
Results 1 to 7 of 7

Compare column names and copy data from several sheets only where column exists else blank

  1. #1
    Registered User
    Join Date
    08-16-2013
    Location
    rugby
    MS-Off Ver
    Excel 2003
    Posts
    4

    Compare column names and copy data from several sheets only where column exists else blank

    Hello absoute beginner at VBA!

    I have a spreadsheet where I would like to copy data from tabs ATPMD, STPPMD, and SBMD to tab Core, I would like the code to copy in row data where the column name matches on the above tabs.

    Thank you so much
    Attached Files Attached Files

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,879

    Re: Compare column names and copy data from several sheets only where column exists else b

    I'm not understanding the requirements. Could you give some examples of which data should be copied and the logic. I don't see any columns with the same names as the sheet names for the three sheets. Please clarify.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Registered User
    Join Date
    08-16-2013
    Location
    rugby
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Compare column names and copy data from several sheets only where column exists else b

    Thanks for responding Alan

    Basically where say Material exists in STPPMD I would like to copy row data as below
    113358
    113447
    602186
    1002672
    1004127
    To be copied under material in core, and also where material decription is found, it's data to be copied and so on.

    Many thanks

  4. #4
    Registered User
    Join Date
    08-16-2013
    Location
    rugby
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Compare column names and copy data from several sheets only where column exists else b

    Hi Alan,

    I hope my explanation helped!

    Steve

  5. #5
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,879

    Re: Compare column names and copy data from several sheets only where column exists else b

    Steve:

    Give this a try:

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    08-16-2013
    Location
    rugby
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Compare column names and copy data from several sheets only where column exists else b

    Alan

    Firstly thank you so much for your time, I ran the code, it ran and left me on tab SBMD but no data was in Core, maybe I am doing something wrong, I received a message saying it was complete but no data.

    Thanks again.

    Steve

  7. #7
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,879

    Re: Compare column names and copy data from several sheets only where column exists else b

    Attached is my copy of your workbook with my code. It worked for me. Scroll down the Core page. I wonder if you have some data in that page that makes the last row be something other than row 2.
    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)

Similar Threads

  1. Copying row of data to new sheets if specific value exists in column
    By raz333 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-26-2013, 03:53 PM
  2. [SOLVED] Compare 2 pair of columns then copy value of third column over different sheets
    By a3des in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-13-2012, 09:11 AM
  3. if partial data exists in one colum, copy to another column
    By Gunther in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-16-2011, 09:23 AM
  4. Compare column B - If exists then update date, else copy to end
    By jimbob121 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-06-2011, 02:21 PM
  5. VBA - Compare one column in two sheets & copy unmatched to one sheet
    By TreasureCat in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-19-2007, 11:18 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