+ Reply to Thread
Results 1 to 6 of 6

Copy comments to a new range of the same size (without using copy, paste)

  1. #1
    Forum Contributor
    Join Date
    08-19-2009
    Location
    Netherlands, Amsterdam
    MS-Off Ver
    Excel 2010
    Posts
    585

    Copy comments to a new range of the same size (without using copy, paste)

    Hello all,

    I'd like to copy a range of values with all its comments to a new range of the same size.
    I know this can be easily done with copy and paste but I need it to be done without copying.

    This is was I got so far, but it seems that comments are not taken into an array

    Please Login or Register  to view this content.
    Any ideas?

  2. #2
    Forum Expert
    Join Date
    08-16-2015
    Location
    Antwerpen, Belgium
    MS-Off Ver
    2007-2016
    Posts
    2,380

    Re: Copy comments to a new range of the same size (without using copy, paste)

    LastRowName
    n

    need more explication

  3. #3
    Forum Expert
    Join Date
    06-25-2009
    Location
    Sofia, Bulgaria, EU
    MS-Off Ver
    Excel 2003-2013
    Posts
    1,290

    Re: Copy comments to a new range of the same size (without using copy, paste)

    Note that I'm not able to test, but this should work

    Please Login or Register  to view this content.
    Note that there number of problems in your code
    1.As you have done it Arr is Array and holds just the values of the Range, not the respective Range object itself
    2. Given 1 it does not have Comment property
    3. You have On Error Resume Next which prevents you from actually seeing what the problem is
    4. Unless you have Option Base =1, UBound will be 1 lower than you expect (by default array index is 0-based)
    5. your loop is not the best one
    If you are pleased with a member's answer then use the Star icon to rate it.

  4. #4
    Forum Contributor
    Join Date
    08-19-2009
    Location
    Netherlands, Amsterdam
    MS-Off Ver
    Excel 2010
    Posts
    585

    Re: Copy comments to a new range of the same size (without using copy, paste)

    Dear Ruban,
    Your solution worked just great.
    I only had to insert the "on error resume next" line in because it throws an error message when there is no comment found.

  5. #5
    Forum Expert
    Join Date
    06-25-2009
    Location
    Sofia, Bulgaria, EU
    MS-Off Ver
    Excel 2003-2013
    Posts
    1,290

    Re: Copy comments to a new range of the same size (without using copy, paste)

    Quote Originally Posted by Jonathan78 View Post
    I only had to insert the "on error resume next" line in because it throws an error message when there is no comment found.
    The proper way to handle this is

    Please Login or Register  to view this content.
    Note that if you don't reset On Error Resume Next it will be in force to the end of the sub, so you will not see other errors in the following lines of code
    Last edited by buran; 09-14-2016 at 02:02 PM.

  6. #6
    Forum Contributor
    Join Date
    08-19-2009
    Location
    Netherlands, Amsterdam
    MS-Off Ver
    Excel 2010
    Posts
    585

    Re: Copy comments to a new range of the same size (without using copy, paste)

    Seems I got some bad habits.
    Thanks again!

+ 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. VBA to Lookup, then Copy and Paste Cell Comments
    By chasoe in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-19-2016, 03:07 AM
  2. [SOLVED] Copy & Paste Cell Contents into Comments in another range of cells
    By Barking_Mad in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-12-2015, 06:38 PM
  3. Copy and paste cells with comments
    By ALRuth in forum Excel General
    Replies: 5
    Last Post: 11-21-2014, 11:40 AM
  4. Replies: 7
    Last Post: 02-04-2014, 06:42 PM
  5. Copy/Paste range of data excluding certain rows and copy to another workbook
    By HoerbigAdm in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-12-2012, 02:51 PM
  6. [SOLVED] Copy comments and paste as text
    By Solomon14all in forum Excel General
    Replies: 6
    Last Post: 10-30-2012, 07:39 AM
  7. Copy and paste Comments?
    By proepert in forum Excel General
    Replies: 3
    Last Post: 11-23-2009, 08:01 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