+ Reply to Thread
Results 1 to 5 of 5

copy and paste special values

  1. #1
    Forum Contributor
    Join Date
    09-19-2007
    Posts
    115

    copy and paste special values

    Hello

    I'm using the following code to copy blocks of data, equal column size across yet different row sizes down into a central table.

    Yet when I copy the TableWest I would like PasteSpecial Values to pasted, not copied. I tried replicating the code from above, whilst using the "find last cell used" yet can't figure it out.

    Any suggestions? Also, any suggestion on a more efficient way of copying would be appreciated.

    Cheers
    Please Login or Register  to view this content.

  2. #2
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,885
    This may work for you, and it avoids the various select statements which are usually unnecessary.
    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    09-19-2007
    Posts
    115
    Thanks pjoaquin - that code seems to work great.

    May I ask a question, such that I can learn?

    When the data is copied from TableEast, the With is with TableEast. Yet when data is copied from TableWest, the With is with TableTotal. Why?

    Thanks

  4. #4
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,885
    Glad it worked for you.

    The reason I used 'With TableEast' in the first bit of code is because 'Sheets("TableEast")' would occur twice in that section of code, while 'Sheets("TableTotal")' occurs only once, and it's in a short line of code.

    In the second section of code, while TableWest and TableTotal both occur twice, if I had kept the Sheets("TableTotal") in the second line of code twice it would have made it quite a bit longer. Here's the same code, but using 'With Sheets("TableWest")' instead of 'With Sheets("TableTotal")':
    Please Login or Register  to view this content.
    Yes, you can break a long line of code using " _", but I prefer code that fits on one line if at all possible. Just preference.

  5. #5
    Forum Contributor
    Join Date
    09-19-2007
    Posts
    115
    Thank you for taking the time to explain the code pjoaquin - i've learnt something new.

+ 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 and paste unique values to another worksheet
    By gsrai31 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-28-2009, 11:44 AM
  2. Copy Paste Special Values
    By Lotus123 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-21-2008, 02:11 PM
  3. Right-Click to Paste Special Values
    By DCSwearingen in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 11-06-2007, 03:14 PM
  4. Copy -> Paste Special -> Values (PROBLEM)
    By davehunter in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-04-2007, 09:20 AM
  5. copy and paste special values
    By gregvb in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-09-2007, 01:54 PM

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