View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Gary''s Student Gary''s Student is offline
external usenet poster
 
Posts: 11,058
Default Macro to create a comment with contents from Paste

Cheat and use a "helper" cell:

1. Enter the macro below
2. ASSIGN A SHORTCUT KEY
3. Select the cell you want to copy and do the copy
4. Select the destination cell and run the macro VIA THE SHORTCUT

The macro will do a paste into the helper cell (Z100) and then establish a
comment in the destination cell using the contents of the helper cell.


I stress using the shortcut key because using the menu bar to activate the
macro will ruin the copy/paste buffer (clipboard)


Sub cheater()
Dim r As Range
' gsnu
Set r = Selection
Range("Z100").Select
ActiveSheet.Paste
r.AddComment
r.Comment.Visible = False
r.Comment.Text Text:=Range("Z100").Value
r.Select
End Sub
--
Gary's Student


"Steve Walton" wrote:

I want to be able to create a comment for the current cell and add the
text currently in the Paste buffer.

The macro works fine, but hard codes the text into the macro

Range("E2729").Comment.Text Text:= _
"SteveW:" & Chr(10) & "hard code text....!"

How can I get it to insert paste buffer ?


--

Steve