Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Code to see if Comment Exists | Excel Programming | |||
how do i comment 1000 lines of code at once in vba for excel? | Excel Worksheet Functions | |||
Code to delete all comment boxes | Excel Discussion (Misc queries) | |||
VB Code to size the comment box | Excel Programming | |||
code that might be causing error - please review and comment | Excel Programming |