Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Add Comments with Text From Cells

I'm using the below code to run a macro that add comments to cells. Does
anyone know if there is anyway I can edit the code so that when the
comment box is generated it contains text from a specific cell within
the workbook? I would like to do it this way as the changes requently.


ActiveCell.AddComment
ActiveCell.Comment.Text Text:=""
ActiveCell.Comment.Visible = True

With ActiveCell.Comment.Shape.OLEFormat.Object
..Font.Name = "Arial"
..Font.Size = 20
..Font.Bold = True
..Width = 400
..Height = 300

End With


End Sub


C.






------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default Add Comments with Text From Cells

Coco,

see following 2 variations on the theme..


Sub DoComment1()
With ActiveCell
.ClearComments
With .AddComment("NOTE" & vbLf & Worksheets(1).Range("$a$1").Value)
.Shape.TextFrame.Characters(1, 4).Font.Bold = True
.Shape.TextFrame.Characters(1, 4).Font.Size = 14
.Visible = True
End With
End With
End Sub

Sub DoComment2()
Dim rTgt As Range
Dim rSrc As Range
Dim cNew As Comment

Set rSrc = Application.InputBox( _
Prompt:="Please indicate source", Type:=8)
Set rTgt = ActiveCell
rTgt.ClearComments
Set cNew = rTgt.AddComment("")
With cNew
.Text ("NOTE" & vbLf & rSrc.Value)
.Visible = True
With .Shape.TextFrame.Characters(1, 4)
.Font.Bold = True
.Font.Color = vbRed
.Font.Size = 14
End With
End With
End Sub







keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


coco wrote:

I'm using the below code to run a macro that add comments to cells.
Does anyone know if there is anyway I can edit the code so that when
the comment box is generated it contains text from a specific cell
within the workbook? I would like to do it this way as the changes
requently.


ActiveCell.AddComment
ActiveCell.Comment.Text Text:=""
ActiveCell.Comment.Visible = True

With ActiveCell.Comment.Shape.OLEFormat.Object
Font.Name = "Arial"
Font.Size = 20
Font.Bold = True
Width = 400
Height = 300

End With


End Sub


C.






------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from
http://www.ExcelForum.com/


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
building comments from text cells Michael.Tarnowski Excel Worksheet Functions 20 February 10th 09 10:50 AM
Variable Text in Comments box. Steve Jones Excel Discussion (Misc queries) 3 July 9th 08 04:55 PM
Text Box Comments TashaTart Excel Discussion (Misc queries) 0 May 3rd 06 04:17 PM
how can we copy cells comments text and paste to cells שי פלד Excel Discussion (Misc queries) 3 December 12th 05 05:16 AM
Text disappearing from cells and comments? tlkcpa Excel Discussion (Misc queries) 1 December 7th 05 07:13 AM


All times are GMT +1. The time now is 08:55 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"