Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default comment copy&past!

Hi to everyone,

I'm using this code to copy the text of active cell and paste it to
active cell comment.
I found it at this link:
http://groups.google.com/group/micro...1b96d834965 e

It works very well but what I'd like to do is that:
a pop up form where I can chose to copy and past the cell content in
its comment but leaving than the cell empty.
The second choice of this pop up have to give to me the possibility to
disable the macro and to use the cell like another.

Hear is the code:

Private Sub Worksheet_Change(ByVal Target As Range)
'Target is a reference to the range that was changed
Const cCheckRange = "A1:J10" 'define range in which this is active
Dim rngR As Range
Dim strExistingText As String, strNewText As String
For Each rngR In Target 'Target may have more than one cell
'is it part of the desired range?
If Range(cCheckRange).Address = Union(Range(cCheckRange),
rngR).Address Then
With rngR
strNewText = Format(Now, "dd/mm/yyyy hh:mm AM/PM") &
Chr(10) & .Value
On Error Resume Next
strExistingText = .Comment.Text 'triggers error if no
comment
On Error GoTo 0
If strExistingText = "" Then
'no existing comment, so add new
.AddComment strNewText
Else
'is existing comment
.Comment.Text strExistingText & Chr(10) & strNewText
End If
'sort out comment size - cannot do directly, so longwinded
way
.Comment.Visible = True
.Comment.Shape.Select
Selection.AutoSize = True
.Comment.Visible = False
End With
End If
Next rngR
End Sub

Many thanks to everyone want help me!
Bye, Stefano.
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 Macro J.W. Aldridge Excel Programming 3 September 21st 07 10:18 PM
Copy and Past Joe Excel Discussion (Misc queries) 1 August 17th 06 02:10 AM
copy & past in same format copy/past -in same format-with blank row Excel Discussion (Misc queries) 0 July 27th 06 07:29 PM
Copy Past with macro Murat D. Hekimošlu Excel Programming 1 May 24th 05 02:00 PM
a comment plugin & copy paste directly from excel to comment ? fr. RFM Excel Worksheet Functions 0 December 1st 04 11:29 PM


All times are GMT +1. The time now is 05:11 AM.

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

About Us

"It's about Microsoft Excel"