Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default How to add comment into cells by VBA code?

Hi,I want to add comment into cells by VBA code. Would you tell me how to
implement? Thanks!


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 747
Default How to add comment into cells by VBA code?

Try:
Range("A1").AddComment Text:="Monkeys eat banannas"

Regards,
Greg

"Terry" wrote:

Hi,I want to add comment into cells by VBA code. Would you tell me how to
implement? Thanks!



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 789
Default How to add comment into cells by VBA code?

Hi

On error resume next
Range("A1").AddComment
on error goto 0
With Range("A1").Comment
.Shape.Placement = xlMoveAndSize
.Shape.Height = 20
.Shape.Width = 30
.Visible = False
.Text "See my example text"
End With

The "on error resume next" and "on error goto 0" are useful if you
don't know if the cell already has a comment. If you know it does not,
then you can omit the error catching. The .Placement is there so that
if you hide columns using code, you won't get an error. If you know you
are not going to hide columns, then you can omit it. The .Visible
property just means you see the tab rather than the whole comment
(until you mouseover). The Height and Width properties can also be
omitted, but hiding and reshowing columns in code can upset the
dimensions of comments.

regards
Paul

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
Code to see if Comment Exists wardides[_13_] Excel Programming 6 November 28th 05 08:56 PM
how do i comment 1000 lines of code at once in vba for excel? Anne Troy Excel Worksheet Functions 1 July 7th 05 01:39 AM
Code to delete all comment boxes Shawn Excel Discussion (Misc queries) 1 June 2nd 05 03:21 PM
VB Code to size the comment box SUNIL PATEL Excel Programming 1 July 1st 04 09:26 PM
code that might be causing error - please review and comment bruce forster Excel Programming 4 May 21st 04 03:06 AM


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