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

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.

Snakehips

Well-known Member
Joined
May 17, 2009
Messages
5,578
Office Version
  1. 365
  2. 2010
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:
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,167,991
Messages
5,856,689
Members
431,828
Latest member
kARTIK12345

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