Link Comments from Another Workbook

Dom1878

New Member
Joined
Jun 22, 2015
Messages
1
Hi,

I currently have a file which has figures and comments, which need to be linked to another workbook. I've pasted as links and that works for the cells however the comments don't carry over. In an effort to do this, i've created some VBA I thought may be useful.

I created the function:

Public Function FetchComment(cell As Range) As String
Dim CellComment As Comment


Application.Volatile False


Set CellComment = cell.Comment


If CellComment Is Nothing Then
FetchComment = ""
Exit Function
End If


If CellComment.Text = "" Then
FetchComment = ""
Else
FetchComment = cell.Comment.Text
End If


End Function



To extract the comment from a given location. The plan was to paste the solution to this into a comment of the activecell.

So basically the VBA goes through cells A1:Z20 on the workbook I want - which has all been linked to the workbook I want to copy the notes from, so it uses the link in the active cell to extract the notes and paste into the comment box. However, the function will not work as it needs a range and I currently have a string as its an address. So the VBA at the moment is:

Sub Comments()
Dim rng As Range
Dim cell As Variant
Dim MyString As String
Dim Range1 As Range


Set rng = Range("A1:Z20")


For Each cell In rng
With cell.Select
ActiveCell.ClearNotes

With ActiveCell
.AddComment (FetchComment(Right((ActiveCell.Formula), Len(ActiveCell.Formula) - 1))
End With
End With
Next


End Sub





At the moment Right((ActiveCell.Formula), Len(ActiveCell.Formula) - 1) is equal to C:\Users\****\Documents\[TestActive.xlsm]Sheet1'!A1

Any help would be appreciated as I'm a beginner when it comes to VBA

Thanks,

Dom
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.

Forum statistics

Threads
1,224,550
Messages
6,179,458
Members
452,915
Latest member
hannnahheileen

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