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
 

Some videos you may like

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.

Snakehips

Well-known Member
Joined
May 17, 2009
Messages
5,069
Office Version
  1. 2013
Platform
  1. Windows
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:

Watch MrExcel Video

Forum statistics

Threads
1,123,143
Messages
5,599,975
Members
414,354
Latest member
Flaxarn

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
Top