LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Adding a comment to a cell in VBA?!

Try something like this. It might give you some insight:

Sub EFGH()
Dim rng As Range
Dim cmt As Comment
Dim DestCPR As String
Dim ocount As Long

DestCPR = "A"
ocount = 10
On Error Resume Next
Set rng = Nothing
Set cmt = Nothing
Set rng = ActiveSheet.Range(DestCPR & ocount)
If rng Is Nothing Then
MsgBox "Invalid range"
Else
Set cmt = Nothing
Set cmt = rng.Comment
If Not cmt Is Nothing Then
MsgBox "cmt exist: " & cmt.Text
Exit Sub
End If
Set cmt = Nothing
Set cmt = rng.AddComment("Formula price")
If cmt Is Nothing Then
MsgBox "Range Good, Comment Bad"
End If
End If
On Error GoTo 0

End Sub

--
Regards,
Tom Ogilvy



"Maury Markowitz" wrote in
message ...
"Dave Peterson" wrote:

Are you sure the correct sheet is active?


Yes.

Is that activesheet protected?


No.

What else does the error message say?


Nothing, just the generic error, whatever it was.

Maury



 
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
adding a hyper link to a cell comment Christopher Buxton Excel Discussion (Misc queries) 6 June 25th 07 07:20 PM
Adding a comment to a cell mancitmis New Users to Excel 2 November 3rd 05 08:52 AM
adding comment to cell mancitmis Excel Discussion (Misc queries) 1 November 2nd 05 03:15 PM
Adding a comment to a formula-not a cell Floridagal Excel Discussion (Misc queries) 4 January 6th 05 12:23 AM
Adding Comment to cell Troy H Excel Programming 5 May 14th 04 09:31 AM


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