Copying a cells contents from one sheet and pasting as comment in another sheet's cell

jmkelly1988

New Member
Joined
Dec 7, 2016
Messages
19
The following code works for copying and pasting, but not for copying then pasting as comments on another sheet. Can anyone help?
Code:
 Dim mainWS As Worksheet, copyWS As Worksheet, fmAry As Variant, toAry As Variant, lr As Long, x As Long, main2WS As Worksheet, copy2WS As Worksheet, z As Long, fm2Ary As Variant, to2Ary As Variant
   
Set mainWS = Worksheets("Programmer")
Set copyWS = Worksheets("WOD Calendar")
Set main2WS = Worksheets("Graph Input Data")
Set copy2WS = Worksheets("Graph Data")
With copyWS
    If .Range("A3") = "" Then
        lr = 3
        x = lr
        y = lr + 1
    Else
        lr = .Cells(Rows.Count, 2).End(xlUp).Row
    End If
    If lr > 3 Then
        x = lr + 2
    End If
End With
fmAry = Array("M26", "N26", "O26", "P26", "Q26", "R26", "S26")
toAry = Array("F" & x, "L" & x, "R" & x, "X" & x, "AD" & x, "AJ" & x, "AP" & x)
    For j = LBound(fmAry) To UBound(fmAry)
        mainWS.Range(fmAry(j)).Copy
        copyWS.Range(toAry(j)).PasteSpecial xlPasteComment
    Next
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
jmkelly1988,

Try....
Code:
For j = LBound(fmAry) To UBound(fmAry)        
On Error Resume Next
            copyWS.Range(toAry(j)).AddComment
            copyWS.Range(toAry(j)).Comment.Text Text:=mainWS.Range(fmAry(j)).Value
        On Error GoTo 0
    Next

Hope that helps.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,782
Messages
6,121,532
Members
449,037
Latest member
tmmotairi

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