Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Remove text from Comment and paste into cell


Hi,

I have a file where there are many cells with comment boxes attached t
them. What I am wanting to do is to have a macro that will :-

1. find each comment box
2. cut or copy the contents of the comment box
3. and place the text into a cell in the next column

Is there a way to do this with a macro or do I have to do it manually?

Cheers,
Bern

--
Bernz
-----------------------------------------------------------------------
BernzG's Profile: http://www.excelforum.com/member.php...fo&userid=2294
View this thread: http://www.excelforum.com/showthread.php?threadid=39283

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Remove text from Comment and paste into cell

Hi Bercz,

Try:

'==========================
Public Sub Tester03()
Dim SH As Worksheet
Dim rng As Range
Dim rCell As Range

Set SH = ActiveSheet '<<======= CHANGE
On Error Resume Next
Set rng = SH.Cells.SpecialCells(xlCellTypeComments)
On Error GoTo 0

If Not rng Is Nothing Then
For Each rCell In rng
rCell(1, 2).Value = rCell.Comment.Text
Next rCell
End If

End Sub
'<<==========================


---
Regards,
Norman



"BernzG" wrote in
message ...

Hi,

I have a file where there are many cells with comment boxes attached to
them. What I am wanting to do is to have a macro that will :-

1. find each comment box
2. cut or copy the contents of the comment box
3. and place the text into a cell in the next column

Is there a way to do this with a macro or do I have to do it manually?

Cheers,
Bernz


--
BernzG
------------------------------------------------------------------------
BernzG's Profile:
http://www.excelforum.com/member.php...o&userid=22949
View this thread: http://www.excelforum.com/showthread...hreadid=392832



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Remove text from Comment and paste into cell

Hi Bercz,

To additionally delete the comment text or, alternatively, to delete the
comments, try:

'==========================
Dim SH As Worksheet
Dim rng As Range
Dim rCell As Range

Set SH = ActiveSheet
On Error Resume Next
Set rng = SH.Cells.SpecialCells(xlCellTypeComments)
On Error GoTo 0

If Not rng Is Nothing Then
For Each rCell In rng
With rCell
.Item(1).Value = rCell.Comment.Text
.Comment.Delete

'To create a blank comment, un-comment the next line
' .AddComment Text:=""

End With
Next rCell
End If

End Sub
'<<==========================

To delete all comments, use as above.

To replace the comments with blank comments, un-comment (remove the initial
apostrophe) in the line:

' .AddComment Text:=""


---
Regards,
Norman



"Norman Jones" wrote in message
...
Hi Bercz,

Try:

'==========================
Public Sub Tester03()
Dim SH As Worksheet
Dim rng As Range
Dim rCell As Range

Set SH = ActiveSheet '<<======= CHANGE
On Error Resume Next
Set rng = SH.Cells.SpecialCells(xlCellTypeComments)
On Error GoTo 0

If Not rng Is Nothing Then
For Each rCell In rng
rCell(1, 2).Value = rCell.Comment.Text
Next rCell
End If

End Sub
'<<==========================


---
Regards,
Norman



"BernzG" wrote in
message ...

Hi,

I have a file where there are many cells with comment boxes attached to
them. What I am wanting to do is to have a macro that will :-

1. find each comment box
2. cut or copy the contents of the comment box
3. and place the text into a cell in the next column

Is there a way to do this with a macro or do I have to do it manually?

Cheers,
Bernz


--
BernzG
------------------------------------------------------------------------
BernzG's Profile:
http://www.excelforum.com/member.php...o&userid=22949
View this thread:
http://www.excelforum.com/showthread...hreadid=392832





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Remove text from Comment and paste into cell


Hi Norman,

Thanks - worked perfectly.

Cheers,
Bernz


--
BernzG
------------------------------------------------------------------------
BernzG's Profile: http://www.excelforum.com/member.php...o&userid=22949
View this thread: http://www.excelforum.com/showthread...hreadid=392832

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
How to paste text into a comment box using toolbar commands Halifax New Users to Excel 4 January 18th 09 05:45 AM
how do I paste excel text into a comment box? Bonnie Excel Discussion (Misc queries) 1 December 17th 06 09:02 PM
HOW DO I COPY & PASTE A SMALL INFO FM AN XL TO THE CELL COMMENT RAGHAV Excel Worksheet Functions 0 May 3rd 06 03:17 PM
Can I paste information (from several cells) into a cell comment? eli Excel Discussion (Misc queries) 0 January 12th 06 11:47 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 11:12 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"