UDF to copy formatting as well as text?

C

CLR

Hi All.......
Someone, (I don't remember who), sometime, (I don't remember when) was kind
enough to post this fine UDF.

Function copycomment(r As Range)
Application.Volatile
Dim whereami As Range
Set whereami = Application.Caller
If whereami.Comment Is Nothing Then
Else
whereami.Comment.Delete
End If
whereami.AddComment Text:=r.Value
copycomment = ""
End Function

It works great, but now I have a user who wishes to also retain the
FORMATTING from the copied cell as well as the text......is this possible?

TIA
Vaya con Dios,
Chuck, CABGx3
 
J

Jon Peltier

UDFs are only supposed to change the value of a cell it is called from.
There are undocumented actions outside of this limited definition that can
be done with a UDF, but they are unreliable and can lead to instability. I
would consider mucking with comments to be among these undocumented actions.

Instead of a UDF, I would hook up similar code to a worksheet event.

- Jon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top