R
rdwj
I have a table where some cells have comments attached ("Insert" -
"Comments"). As these comments are poorly visible, I am trying to lift the
text in a comment box such that I can make it more visible - I want to show
the text that is included in the comment of the selected cell in a designated
worksheet cell (in this case the top left cell of the table)
I can read the text in the comment through
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Range("A2") = Mid(Target.Comment.Shape.AlternativeText, 10)
end sub
(I have included Mid(...,10) to get rid of the "TextBox : ")
However - if a cell does NOT have a comment, the above gives an error.
How can I ensure that does not block the rest of the code from running (ie
more code under Worksheet_SelectionChange)
Txs,
RDWJ
"Comments"). As these comments are poorly visible, I am trying to lift the
text in a comment box such that I can make it more visible - I want to show
the text that is included in the comment of the selected cell in a designated
worksheet cell (in this case the top left cell of the table)
I can read the text in the comment through
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Range("A2") = Mid(Target.Comment.Shape.AlternativeText, 10)
end sub
(I have included Mid(...,10) to get rid of the "TextBox : ")
However - if a cell does NOT have a comment, the above gives an error.
How can I ensure that does not block the rest of the code from running (ie
more code under Worksheet_SelectionChange)
Txs,
RDWJ