LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 44
Default Adding comment to cells not working with merged cells

I have some code that adds a cells comments to the cell value as below:

Sub CommentsToCells()

Dim cl As Range
Dim rng As Range
Dim cmt As Comment

On Error Resume Next
Set rng = ActiveSheet.Cells.SpecialCells(xlCellTypeComments)
On Error GoTo 0

For Each cl In rng
Set cmt = cl.Comment
cl.Value = cl.Value & " : " & cmt.text
Next cl

End Sub

This works well with unmerged cells but when the cells are merged the cell
value is updated but then the code stops with the error:

Run-time error '91':
Object variable or With block variable not set

How can I get this to work for merged cells as well?
 
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
Form command not working on worksheet with merged cells JohnH Excel Discussion (Misc queries) 0 May 17th 10 01:28 PM
Autofit Merged cell Code is changing the format of my merged cells JB Excel Discussion (Misc queries) 0 August 20th 07 02:12 PM
Adding Merged cells together Amie Excel Discussion (Misc queries) 2 June 21st 07 05:53 AM
Avoiding page breaks across merged cells - Code not working as expected Alan Excel Programming 2 September 26th 05 03:55 AM
Copy/Paste Merged Cells via Macro is not working Peter Bassett Excel Programming 0 January 27th 05 07:24 PM


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