+ Reply to Thread
Results 1 to 7 of 7

Copy/paste and add _ to values

  1. #1
    Registered User
    Join Date
    04-02-2012
    Location
    finland
    MS-Off Ver
    Excel 2010
    Posts
    6

    Copy/paste and add _ to values

    Hi,

    I need a fast macro that will copy values from column A, paste those values in column A on Sheet1, then proceed to column B and paste those values to column A on sheet1, and so forth to column DZ on the original sheet.

    I also want to add _ at the end of every value. Currently I have a macro for adding _:
    Please Login or Register  to view this content.
    But the code is way to unefficient. I've attached a sample file which may better explain what I'm trying to achieve:
    Sample.xlsm

    Thanks in advance

  2. #2
    Valued Forum Contributor
    Join Date
    02-09-2012
    Location
    Mauritius
    MS-Off Ver
    Excel 2007
    Posts
    1,055

    Re: Copy/paste and add _ to values

    Hi
    I have the data copied into sheet4. The output is in sheet1 H column.
    Pls try sub named "test":

    Sample copy.xlsm

    Regards..

  3. #3
    Forum Expert Palmetto's Avatar
    Join Date
    04-04-2007
    Location
    South Eastern, USA
    MS-Off Ver
    XP, 2007, 2010
    Posts
    3,978

    Re: Copy/paste and add _ to values

    Please Login or Register  to view this content.
    Palmetto

    Do you know . . . ?

    You can leave feedback and add to the reputation of all who contributed a helpful response to your solution by clicking the star icon located at the left in one of their post in this thread.

  4. #4
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,475

    Re: Copy/paste and add _ to values

    Try this
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    04-02-2012
    Location
    finland
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Copy/paste and add _ to values

    Thanks for your help. I ended up using the one by Dave as it seemed to be the fastest one.

  6. #6
    Forum Expert Palmetto's Avatar
    Join Date
    04-04-2007
    Location
    South Eastern, USA
    MS-Off Ver
    XP, 2007, 2010
    Posts
    3,978

    Re: Copy/paste and add _ to values

    I doubt there's much speed difference (more perception than reality) as my code and Dave's is nearly identical.
    However, this line of Dave's code:

    Please Login or Register  to view this content.
    is more specific to users of versions prior to Excel 2007+ because those versions are limited to 65, 536 rows.
    Seeing as you are using Excel 2010 and have *MANY* more rows, there is risk of truncating the data if the total number of copied cells in your worksheet exceeds 65,536. Dave's code will not see available rows beyond that number.

    I am using the more generic "Cells" method, which is compatible with any version.

  7. #7
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,475

    Re: Copy/paste and add _ to values

    There doesn't appear to be much difference in the codes except I used .Copy destination:=

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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