Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default How do I set a comment in a cell with VBA?

I should have thought that the command:

range("A1").comment = "This is a comment in cell A1"

would work ... but it doesn't. I get an error message which reads:

"Object variable or With block variable not set"

Can anyone help?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,327
Default How do I set a comment in a cell with VBA?

Record a macro while doing it manually, read it afterwards, and you will see
the light.

Or at least something on a bright white background.

HTH. Best wishes Harald


"Pete at Sappi Fine Paper"
skrev i melding ...
I should have thought that the command:

range("A1").comment = "This is a comment in cell A1"

would work ... but it doesn't. I get an error message which reads:

"Object variable or With block variable not set"

Can anyone help?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default How do I set a comment in a cell with VBA?

Thanks Harald, but I tried that and it didn't work. Even copied the macro
and pasted it into my program. Same error.

"Harald Staff" wrote:

Record a macro while doing it manually, read it afterwards, and you will see
the light.

Or at least something on a bright white background.

HTH. Best wishes Harald


"Pete at Sappi Fine Paper"
skrev i melding ...
I should have thought that the command:

range("A1").comment = "This is a comment in cell A1"

would work ... but it doesn't. I get an error message which reads:

"Object variable or With block variable not set"

Can anyone help?




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default How do I set a comment in a cell with VBA?

Easiest is:

range("A1").notetext text:="This is a comment in cell A1"

--
Regards,
Tom Ogilvy


"Pete at Sappi Fine Paper"
wrote in message ...
I should have thought that the command:

range("A1").comment = "This is a comment in cell A1"

would work ... but it doesn't. I get an error message which reads:

"Object variable or With block variable not set"

Can anyone help?



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default How do I set a comment in a cell with VBA?

Thanks Tom! That worked!

"notetext" instead of "comment" ... now THAT'S intuitive.... *grumble grumble*

"Tom Ogilvy" wrote:

Easiest is:

range("A1").notetext text:="This is a comment in cell A1"

--
Regards,
Tom Ogilvy


"Pete at Sappi Fine Paper"
wrote in message ...
I should have thought that the command:

range("A1").comment = "This is a comment in cell A1"

would work ... but it doesn't. I get an error message which reads:

"Object variable or With block variable not set"

Can anyone help?






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default How do I set a comment in a cell with VBA?

Hi Pete,


"notetext" instead of "comment" ... now THAT'S intuitive.... *grumble
grumble*


See Tom's earlier post:

http://tinyurl.com/77a7l


---
Regards,
Norman



"Pete at Sappi Fine Paper"
wrote in message ...
Thanks Tom! That worked!

"notetext" instead of "comment" ... now THAT'S intuitive.... *grumble
grumble*

"Tom Ogilvy" wrote:

Easiest is:

range("A1").notetext text:="This is a comment in cell A1"

--
Regards,
Tom Ogilvy



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default How do I set a comment in a cell with VBA?

Hi Pete,

For an existing comment try:

Range("A1").Comment.Text _
"This is a comment in cell A1"


or to create the comment:

With ActiveSheet.Range("A1").AddComment
.Text "Howdy!"
End With

---
Regards,
Norman



"Pete at Sappi Fine Paper"
wrote in message ...
I should have thought that the command:

range("A1").comment = "This is a comment in cell A1"

would work ... but it doesn't. I get an error message which reads:

"Object variable or With block variable not set"

Can anyone help?



  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default How do I set a comment in a cell with VBA?

Thanks Norman. I'll bear this in mind, but Tom's solution worked so I'm
sticking with that for the moment.

"Norman Jones" wrote:

Hi Pete,

For an existing comment try:

Range("A1").Comment.Text _
"This is a comment in cell A1"


or to create the comment:

With ActiveSheet.Range("A1").AddComment
.Text "Howdy!"
End With

---
Regards,
Norman



"Pete at Sappi Fine Paper"
wrote in message ...
I should have thought that the command:

range("A1").comment = "This is a comment in cell A1"

would work ... but it doesn't. I get an error message which reads:

"Object variable or With block variable not set"

Can anyone help?




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
Can insert digital ink into Excel cell or a cell comment? Nickbray Excel Discussion (Misc queries) 1 June 2nd 10 03:53 AM
copy comment content to cell content as data not as comment Lilach Excel Discussion (Misc queries) 2 June 21st 07 12:28 PM
Create Cell Comment based on text in a cell on another worksheet Dave Fellman Excel Discussion (Misc queries) 2 March 15th 07 09:49 AM
I want to change comment printing cell 3 to whats in cell 3 Lonny and Rinda Excel Worksheet Functions 3 June 19th 06 08:36 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 10:22 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"