Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
CLR CLR is offline
external usenet poster
 
Posts: 1,998
Default UDF to copy formatting as well as text?

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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,582
Default UDF to copy formatting as well as text?

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
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services, Inc.
http://PeltierTech.com/WordPress/
_______


"CLR" wrote in message
...
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




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy and Past Values AND Formatting AND Text KKD Excel Discussion (Misc queries) 1 May 6th 10 06:25 PM
How to force column formatting (text, date, etc) when loading a fixed width text file into an array? ker_01 Excel Programming 3 October 21st 08 08:45 PM
Find formatting in text in cell, insert tags around formatting. CarlC Excel Programming 2 February 27th 08 09:26 PM
Copy text with formatting from an Excel cell into an embedded Word object? [email protected] Excel Programming 0 January 8th 07 05:32 PM
How do I copy text formatting using a formula? topsquark Excel Discussion (Misc queries) 2 October 11th 05 02:41 PM


All times are GMT +1. The time now is 09:07 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"