#1   Report Post  
Posted to microsoft.public.excel.misc
Jon Jon is offline
external usenet poster
 
Posts: 183
Default Comments

Hey everyone. I just signed up to have this one issue solved. I have a large
spreadsheet that includes many comments. Occasionally the comments move to
several cells (up to hundreds of cells) below the cell they should be close
to or resize so they are not visible. I have researched how to reformat the
comment boxes using this macro (see below) that I found on the internet and
it works fine except when I go to edit the comments they continue to be
located in random places and the incorrect size. Any help is greatly
appreciated.

Option Explicit

Dim cCell As Range

Dim sComment As Comment

Dim allComments As Range



Sub reset_comments()

On Error Resume Next

Application.ScreenUpdating = False

Set allComments = Range("A1").SpecialCells(xlCellTypeComments)

If allComments Is Nothing Then MsgBox "No comments in " & ActiveSheet.Name:
GoTo Ex

For Each cCell In allComments

With cCell.Comment

..Shape.Height = 200

..Shape.Width = 125

End With

'cCell.Select not necessary ?

cCell.Comment.Visible = True

cCell.Comment.Shape.Select True

With Selection

' .Interior.ColorIndex = 19

..Font.Bold = False

..Font.Size = 10

End With

cCell.Comment.Visible = False

Next cCell

Ex:

Set allComments = Nothing

Application.ScreenUpdating = True

End Sub


  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,718
Default Comments

You might try this.

Sub RestoreComments()
Dim AllCommentCells As Range
Dim Cell As Range
Dim LastCol As Integer
LastCol = ActiveSheet.Columns.Count
Set AllCommentCells = Cells.SpecialCells(xlCellTypeComments)
For Each Cell In AllCommentCells
With Cell.Comment.Shape
.Width = 96
.Height = 55.5
.Top = Cell.Top + 5
If Cell.Column < (LastCol - 3) Then
.Left = Cell.Offset(0, 1).Left + 10
Else
.Left = Cell.Offset(0, (LastCol - Cell.Column) - 3).Left
End If
End With
Next
End Sub

--
Jim
"Jon" wrote in message
...
| Hey everyone. I just signed up to have this one issue solved. I have a
large
| spreadsheet that includes many comments. Occasionally the comments move to
| several cells (up to hundreds of cells) below the cell they should be
close
| to or resize so they are not visible. I have researched how to reformat
the
| comment boxes using this macro (see below) that I found on the internet
and
| it works fine except when I go to edit the comments they continue to be
| located in random places and the incorrect size. Any help is greatly
| appreciated.
|
| Option Explicit
|
| Dim cCell As Range
|
| Dim sComment As Comment
|
| Dim allComments As Range
|
|
|
| Sub reset_comments()
|
| On Error Resume Next
|
| Application.ScreenUpdating = False
|
| Set allComments = Range("A1").SpecialCells(xlCellTypeComments)
|
| If allComments Is Nothing Then MsgBox "No comments in " &
ActiveSheet.Name:
| GoTo Ex
|
| For Each cCell In allComments
|
| With cCell.Comment
|
| .Shape.Height = 200
|
| .Shape.Width = 125
|
| End With
|
| 'cCell.Select not necessary ?
|
| cCell.Comment.Visible = True
|
| cCell.Comment.Shape.Select True
|
| With Selection
|
| ' .Interior.ColorIndex = 19
|
| .Font.Bold = False
|
| .Font.Size = 10
|
| End With
|
| cCell.Comment.Visible = False
|
| Next cCell
|
| Ex:
|
| Set allComments = Nothing
|
| Application.ScreenUpdating = True
|
| End Sub
|
|

  #3   Report Post  
Posted to microsoft.public.excel.misc
Jon Jon is offline
external usenet poster
 
Posts: 183
Default Comments

Thanks Jim! You have saved me a lot of grief trying to figure that out.

Cheers,

Jon

"Jim Rech" wrote:

You might try this.

Sub RestoreComments()
Dim AllCommentCells As Range
Dim Cell As Range
Dim LastCol As Integer
LastCol = ActiveSheet.Columns.Count
Set AllCommentCells = Cells.SpecialCells(xlCellTypeComments)
For Each Cell In AllCommentCells
With Cell.Comment.Shape
.Width = 96
.Height = 55.5
.Top = Cell.Top + 5
If Cell.Column < (LastCol - 3) Then
.Left = Cell.Offset(0, 1).Left + 10
Else
.Left = Cell.Offset(0, (LastCol - Cell.Column) - 3).Left
End If
End With
Next
End Sub

--
Jim
"Jon" wrote in message
...
| Hey everyone. I just signed up to have this one issue solved. I have a
large
| spreadsheet that includes many comments. Occasionally the comments move to
| several cells (up to hundreds of cells) below the cell they should be
close
| to or resize so they are not visible. I have researched how to reformat
the
| comment boxes using this macro (see below) that I found on the internet
and
| it works fine except when I go to edit the comments they continue to be
| located in random places and the incorrect size. Any help is greatly
| appreciated.
|
| Option Explicit
|
| Dim cCell As Range
|
| Dim sComment As Comment
|
| Dim allComments As Range
|
|
|
| Sub reset_comments()
|
| On Error Resume Next
|
| Application.ScreenUpdating = False
|
| Set allComments = Range("A1").SpecialCells(xlCellTypeComments)
|
| If allComments Is Nothing Then MsgBox "No comments in " &
ActiveSheet.Name:
| GoTo Ex
|
| For Each cCell In allComments
|
| With cCell.Comment
|
| .Shape.Height = 200
|
| .Shape.Width = 125
|
| End With
|
| 'cCell.Select not necessary ?
|
| cCell.Comment.Visible = True
|
| cCell.Comment.Shape.Select True
|
| With Selection
|
| ' .Interior.ColorIndex = 19
|
| .Font.Bold = False
|
| .Font.Size = 10
|
| End With
|
| cCell.Comment.Visible = False
|
| Next cCell
|
| Ex:
|
| Set allComments = Nothing
|
| Application.ScreenUpdating = True
|
| End Sub
|
|


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
Comments Richard[_8_] Excel Discussion (Misc queries) 0 June 26th 08 12:44 AM
Comments Francis Hookham Excel Discussion (Misc queries) 2 June 25th 08 08:50 PM
Comments Francis Hookham Excel Discussion (Misc queries) 3 January 7th 08 08:26 PM
in excel useing comments how do you add clip art to comments? dhouse New Users to Excel 2 July 18th 07 08:14 AM
comments Jock Excel Discussion (Misc queries) 2 April 27th 07 08:19 PM


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