Macro To Comment Based on another Sheet

LeBen James

New Member
Joined
Aug 27, 2018
Messages
2
Im trying to create a macro that comments based on another sheet I set up with the text in proper order (ie. A1 on Comment Sheet has Comment that should be in A1 for Sheet 1 and so on). I'm struggling with automating this one, does anyone know how to do this?
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
If you are copying Comments from sheet named "Comments" to a sheet named "Sheet1", try ...
Code:
Sub CopyComments()
    Dim cel As Range
    Dim rng As Range: Set rng = Sheets("Comments").Cells.SpecialCells([COLOR=#ff0000]xlCellTypeComments[/COLOR])
    For Each cel In rng
        With Sheets("Sheet1").Range(cel.Address)
            On Error Resume Next
            .Comment.Delete
            .AddComment
            .Comment.Text Text:=[COLOR=#ff0000]cel.Comment.Text[/COLOR]
        End With
    Next
End Sub

If copying cell text from sheet named "Comments" into cell Comment boxes on "Sheet1", try ...
Code:
Sub CopyCellText()
    Dim cel As Range
    Dim rng As Range: Set rng = Sheets("Comments").Cells.SpecialCells([COLOR=#ff0000]xlCellTypeConstants[/COLOR])
    For Each cel In rng
        With Sheets("Sheet1").Range(cel.Address)
            On Error Resume Next
            .Comment.Delete
            .AddComment
            .Comment.Text Text:=[COLOR=#ff0000]cel.Text[/COLOR]
        End With
    Next
End Sub
CopyCellText ignores formulas
- copy and paste values in sheet "Comments" before running the macro if text in any cells created by formula
 
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,771
Members
452,353
Latest member
strainu

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top