Reputation: 125
I am trying to copy and paste comments from one Excel workbook to another, but the comments don't get pasted after being copied from the first workbook.
Here is my code:
Sub Comments()
Dim x As Workbook
Dim y As Workbook
Set x = Workbooks.Open("C:\Exportbook.xlsx")
Set y = ActiveWorkbook
x.Sheets("Tablets").Range("E10:AQ2000").Copy
y.Sheets("Tablets").Range("E10:AQ2000").PasteSpecial Paste:=xlPasteComments
x.Close SaveChanges:=False
End Sub
Upvotes: 2
Views: 194
Reputation: 426
You need to use ThisWorkbook instead of ActiveWorkbook.
Currently your code copies and pastes from/to the same location. After opening workbook x it will become the active workbook, so workbook y is the same as workbook x.
Upvotes: 1