Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default comments in Excel

Hi,
Is it possible to read with VBA comment in a cell and put it as a text in
the first free cell at the same row?
Thanks for your help.

Ireneusz


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default comments in Excel

Yep.

Option Explicit
Sub testme02()
Dim myCommentCells As Range
Dim myCell As Range
Dim DestCell As Range

With ActiveSheet
Set myCommentCells = Nothing
On Error Resume Next
Set myCommentCells = .Cells.SpecialCells(xlCellTypeComments)
On Error GoTo 0

If myCommentCells Is Nothing Then
MsgBox "no comments"
Exit Sub
End If

For Each myCell In myCommentCells.Cells
.Cells(myCell.Row, .Columns.Count).End(xlToLeft).Offset(0, 1) _
.Value = myCell.Comment.Text
Next myCell
End With
End Sub

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Reniek wrote:

Hi,
Is it possible to read with VBA comment in a cell and put it as a text in
the first free cell at the same row?
Thanks for your help.

Ireneusz


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 903
Default comments in Excel

Hi Irene,
Yes, it is possible, I would suggest using a function so that it is brought
into the cell of your choice. Avoids duplications and other problems.
Avoid problems with several different columns needing a wider column for
the text of a comment that does not match the rest of the cells in a column.

Cell Comments: http://www.mvps.org/dmcritchie/excel....htm#mycomment

There are other solutions on the page as well.


You can see the kind of code you need within this test of an event macro

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Cells(Target.row, Columns.Count).End(xlToLeft).Offset(0, 1).Value _
= Target.Comment.Text
End Sub


To populate the first available after the last used cell on a row
-- there is no error checking, and the populated cells may not line up.

Sub PopulateFirstAvailableCellOnRowCommentText()
Dim cmt As Comment
For Each cmt In ActiveSheet.Comments
Cells(cmt.Parent.Row, Columns.Count).End(xlToLeft).Offset(0, 1).Value _
= cmt.Text
Next cmt
End Subt


---HTH, David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]My Excel Pages:
http://www.mvps.org/dmcritchie/excel/excel.htmSearch Page: http://www.mvps.org/dmcritchie/excel/search.htm "Reniek"
wrote in message ...
Hi,
Is it possible to read with VBA comment in a cell and put it as a text in
the first free cell at the same row?
Thanks for your help.

Ireneusz





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
excel 2000 how to format the comments font all comments Delquestion Excel Discussion (Misc queries) 1 October 8th 09 02:19 PM
Excel Comments lisa Excel Worksheet Functions 5 June 25th 09 08:42 PM
Excel comments zonegrise Excel Worksheet Functions 1 June 16th 09 10:51 PM
in excel useing comments how do you add clip art to comments? dhouse New Users to Excel 2 July 18th 07 08:14 AM
Excel Comments George Godik Excel Programming 2 January 14th 04 07:54 PM


All times are GMT +1. The time now is 01:59 PM.

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"