+ Reply to Thread
Results 1 to 6 of 6

Copy columns A and B values from Table1 on Sheet1 to Table2 on Sheet2

  1. #1
    Forum Contributor
    Join Date
    05-25-2019
    Location
    Sioux Falls, South Dakota
    MS-Off Ver
    Microsoft 365
    Posts
    178

    Copy columns A and B values from Table1 on Sheet1 to Table2 on Sheet2

    Upon sheet.activate, the code below copies the entire contents of Table1 to Table2. However, I wish to copy only the values contained in columns A and B onto Table2. The values in columns D, E, and F in Table2 should not change when this happens. Each time a new row is added to Table1, a new date populated in column B, which should also result in a new row and date in column B in Table2.

    I researched and tried numerous other related codes but failed to get anything to work. This code is the closest I could get. How can this code be rewritten to do as described above?


    Please Login or Register  to view this content.
    Attached Files Attached Files

  2. #2
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: Copy columns A and B values from Table1 on Sheet1 to Table2 on Sheet2

    Give this a try:
    Please Login or Register  to view this content.
    BSB

  3. #3
    Forum Contributor
    Join Date
    05-25-2019
    Location
    Sioux Falls, South Dakota
    MS-Off Ver
    Microsoft 365
    Posts
    178

    Re: Copy columns A and B values from Table1 on Sheet1 to Table2 on Sheet2

    BadlySpelledBuoy,

    That does copy A and B column data down to the same row and leaves the other columns blank. Hard to believe there's finally an answer to this issue! Thanks so much! One thing that it didn't do is paste values only. I preferred to not have the A & B column formulas to be copied on the designation sheet.

    Nevertheless, I was able to record macro a copy and paste script and added onto the code (see below). This does remove the formulas and inserted the values only. I do wonder, however, if there is a neater code than what I created that achieves the same objective. If so, how would that be written?

    Please Login or Register  to view this content.
    Regardless, I am super thrilled to have this generous gift of code. Thanks!
    Last edited by Dbroek; 07-11-2022 at 06:09 PM.

  4. #4
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: Copy columns A and B values from Table1 on Sheet1 to Table2 on Sheet2

    Perhaps like this?
    Please Login or Register  to view this content.
    BSB

  5. #5
    Forum Contributor
    Join Date
    05-25-2019
    Location
    Sioux Falls, South Dakota
    MS-Off Ver
    Microsoft 365
    Posts
    178

    Re: Copy columns A and B values from Table1 on Sheet1 to Table2 on Sheet2

    Exactly like that! Amazing how concise this is and how effortlessly you answered this. Maybe I did a bad job searching on the ‘net but there wasn’t anything I could find even remotely similar to these code lines for this kind of problem. Only change I had to make was to insert a “Range("A1").Select” line at the end to bring it out of highlight mode.
    😊

  6. #6
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: Copy columns A and B values from Table1 on Sheet1 to Table2 on Sheet2

    I think the problem with searching for help on Excel (or similar) issues online is although you may know exactly what you want to achieve it's not always easy finding the correct phrasing. Search engines are a lot better now than even a few years ago at "guessing" what you mean by searching for alternative words to the ones you actually entered, but it's still a fine art to match your search phrase with that of an already provided solution to the same issue.
    Combine that with the fact that in Excel there are always multiple ways of accomplishing the same thing and it gets even trickier. So don't beat yourself up for doing a "bad job" searching. You found this forum and you got a solution, so couldn't have been that bad a job!!

    As for how effortlessly I answered it, if you'd been using Excel and writing code for as long as I have (it's been my job for 20+ years), you'd have answered it effortlessly too

    Glad I could help and thanks for the rep!

    Good luck with the rest of the build. You know where we are if you need more help with it.

    BSB

+ 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 unique databodyrange from table1 to table2
    By sniper1 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-07-2020, 02:25 AM
  2. [SOLVED] Copy columns from table1 to table2
    By sniper1 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-05-2020, 01:54 PM
  3. Populate and rezise table2 as table1 changes
    By Dresas in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-05-2017, 01:03 PM
  4. [SOLVED] How to convert uploaded table1 to table2?
    By tta.akmal in forum Excel General
    Replies: 5
    Last Post: 04-16-2017, 08:04 AM
  5. Replies: 6
    Last Post: 07-25-2013, 02:58 PM
  6. How to copy Table2 columns in to Table1 ?
    By bsaimsc in forum Access Programming / VBA / Macros
    Replies: 1
    Last Post: 10-04-2012, 07:13 AM
  7. delect values in Sheet1 and copy values from Sheet2 and then paste in Sheet1
    By drpramanik in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-02-2011, 05:28 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