+ Reply to Thread
Results 1 to 9 of 9

Copy and Paste with Ignoring Copying Comments

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    07-20-2012
    Location
    Kingdom of Saudi Arabia
    MS-Off Ver
    Excel 2016
    Posts
    103

    Question Copy and Paste with Ignoring Copying Comments

    Hello,

    how can i copy and paste (Texts, Formats, Shapes) from a range to another range with ignoring copying comments

    With wksPasteTo
    
            For Each rngArea In rngPasteToRange.Areas:
               
                wksCopyFrom.Range(rngArea.Address).Copy .Range(rngArea.Address)  '---Copy and Paste Without Comments
            
            Next rngArea
    
    End with
    Thank you very much.

  2. #2
    Forum Contributor
    Join Date
    07-20-2012
    Location
    Kingdom of Saudi Arabia
    MS-Off Ver
    Excel 2016
    Posts
    103

    Re: Copy and Paste with Ignoring Copying Comments

    For example, when i want to disable copying shapes i use this line

    Application.CopyObjectsWithCells = False
    Is there a line like (Application.CopyCommentsWithCells = False) to disable copying comments?

    or Is there any method to prevent copying comments?
    Last edited by exceere; 03-21-2020 at 06:30 PM.

  3. #3
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Copy and Paste with Ignoring Copying Comments

    You could clear the pasted comments.

    You don't need the With statement.

        For Each rngArea In rngPasteToRange.Areas
           
            wksCopyFrom.Range(rngArea.Address).Copy Destination:=rngArea
            rngArea.ClearComments
            
        Next rngArea
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  4. #4
    Forum Contributor
    Join Date
    07-20-2012
    Location
    Kingdom of Saudi Arabia
    MS-Off Ver
    Excel 2016
    Posts
    103

    Re: Copy and Paste with Ignoring Copying Comments

    AlphaFrog, Thank you very much.

    but this will clear the already existing comments in the rngArea.

  5. #5
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Copy and Paste with Ignoring Copying Comments

    Quote Originally Posted by exceere View Post
    AlphaFrog, Thank you very much.

    but this will clear the already existing comments in the rngArea.
    Actually, when you Paste, it clears your pre-existing comments.

    Do you really copy Shapes too? If no, use this...
        For Each rngArea In rngPasteToRange.Areas
           
            wksCopyFrom.Range(rngArea.Address).Copy
            rngArea.PasteSpecial xlPasteValuesAndNumberFormats
            rngArea.PasteSpecial xlPasteFormats
            
        Next rngArea
        Application.CutCopyMode = False

    If you do copy shapes, this method will temporarily store the comments 100 columns to the right, and then retrieve them after the paste

        For Each rngArea In rngPasteToRange.Areas
           
            'temp store comments
            rngArea.Copy
            rngArea.Offset(, 100).PasteSpecial xlComments
            
            'Copy\paste everything
            wksCopyFrom.Range(rngArea.Address).Copy Destination:=rngArea
            
            'retrieve comments
            rngArea.ClearComments
            rngArea.Offset(, 100).Copy
            rngArea.PasteSpecial xlComments
            rngArea.Offset(, 100).ClearComments
            
            
        Next rngArea

  6. #6
    Forum Contributor
    Join Date
    07-20-2012
    Location
    Kingdom of Saudi Arabia
    MS-Off Ver
    Excel 2016
    Posts
    103

    Re: Copy and Paste with Ignoring Copying Comments

    AlphaFrog, Thank you very much for sharing your mind and time.

    Yes, this method solve the issue but it takes a more time to execute (because it has more than 3 operations copy/paste/copy/paste/clear...).

    Is there an alternative with less operations.

  7. #7
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Copy and Paste with Ignoring Copying Comments

    I don't know of one. Otherwise, I would have suggested it.

    It's not that slow. You can speed it up by adding this before and after the For-Next loop

    Application.ScreenUpdating = False
    'For\Next 
    Application.ScreenUpdating = True

  8. #8
    Forum Contributor
    Join Date
    07-20-2012
    Location
    Kingdom of Saudi Arabia
    MS-Off Ver
    Excel 2016
    Posts
    103

    Re: Copy and Paste with Ignoring Copying Comments

    Thank you AlphaFrog,

    I use these magic lines always.

  9. #9
    Forum Contributor
    Join Date
    07-20-2012
    Location
    Kingdom of Saudi Arabia
    MS-Off Ver
    Excel 2016
    Posts
    103

    Re: Copy and Paste with Ignoring Copying Comments

    at this moment, i used AlphaFrog's idea to overcome this issue.

    But, waiting to another guy to share his mind to overcome this issue with less lines.

    Thanks.

+ 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. [SOLVED] Copy/Paste with cell comments and check boxes
    By ExcelBruh in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-24-2019, 09:00 PM
  2. [SOLVED] Copy comments to a new range of the same size (without using copy, paste)
    By Jonathan78 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-14-2016, 02:01 PM
  3. 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
  4. Copy and paste cells with comments
    By ALRuth in forum Excel General
    Replies: 5
    Last Post: 11-21-2014, 11:40 AM
  5. Replies: 7
    Last Post: 02-04-2014, 06:42 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