![]() |
#1
|
|||
|
|||
![]()
Hi everyone,
I searched the Forum but I didn't find anything about it. How is it possible to copy data and paste them into a comment in a specific cell? Once in a week I have to fill 10x7=70 comments in cells of an Excel file with a lot of data that I get from an other excel file. This work takes a lot of time entering manually all data!! I was wondering if it is possible to simplify this work. Thank you in advance for your help. Andrea |
#2
|
||||
|
||||
![]()
Yes, it is possible to use a macro to add content to comments. For example, the following macro adds the formulae to the comments for each selected cell, or even the whole worksheet, and displays the comments in an appropriately-sized box.
Code:
Sub AddFormulasToComments() Application.ScreenUpdating = False Dim CommentRange As Range, TargetCell As Range 'skip over errors caused by trying to delete comments in cells with no comments On Error Resume Next 'If the whole worksheet is selected, limit action to the used range. If Selection.Address = Cells.Address Then Set CommentRange = Range(ActiveSheet.UsedRange.Address) Else Set CommentRange = Range(Selection.Address) End If 'If the cell contains a formula, turn it into a comment. For Each TargetCell In CommentRange With TargetCell 'check whether the cell has a formula If Left(.Formula, 1) = "=" Then 'delete any existing comment .Comment.Delete 'add a new comment .AddComment 'copy the formula into the comment box .Comment.Text Text:=.Formula 'display the comment .Comment.Visible = True End If End With Next MsgBox " To print the comments, choose" & vbCrLf & " File|Page Setup|Sheet|Comments," & vbCrLf & "then choose the required print option.", vbOKOnly Application.ScreenUpdating = True End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
![]()
Thank you,
I will try to use it today! Cheers Andrea |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
mross127 | Word | 10 | 08-16-2017 04:41 PM |
![]() |
A_Lau | Drawing and Graphics | 3 | 12-19-2014 06:57 AM |
How to Copy data from Outlook mail and Paste it in a Excel sheet? | padhu1989 | Outlook | 0 | 09-11-2012 04:07 AM |
![]() |
raven26c | Word | 1 | 11-18-2011 02:49 AM |
copy/paste charts from excel to word | bielak01 | Excel | 0 | 04-16-2009 02:27 AM |