Adjusting comment positions &

Tibe2010

New Member
Joined
Apr 5, 2024
Messages
4
Office Version
  1. 2019
Platform
  1. MacOS
I have a spreadsheet with comments in several cells. I uploaded the spreadsheet to Google drive to share with others. I exported the spreadsheet back to Excel in my local drive. Now the comments are all over the place. Some of them are squished and look like a line when hovering over the cell. They are also moved away from the cell. Do you know of VBA code that can search in the entire workbook for cells with comments then move the near the cell and adjust the window where the comments are displayed properly?

Thank you in advance.
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
Have a try with this snippet:
VBA Code:
Sub ResetComments()
    'resets comments to Original Position
    Dim cmt   As Comment
    For Each cmt In ActiveSheet.Comments
        With cmt
            .Shape.Top = cmt.Parent.Top + 5       '<- adjust distance offset if needed
            .Shape.Left = cmt.Parent.Offset(0, 1).Left + 5 '<- adjust distance offset if needed
            .Visible = False                      '<- use if they need to stay hidden
        End With
    Next
End Sub
 
Upvote 0
Thank you for the code you shared. It moved the comment box closer to the cell as expected but the comment box is still squished as you see in the screenshot attached.

Screenshot 2024-04-06 at 10.28.26 AM.png
 
Upvote 0
As fare as I know the original sizes of the comment boxes are no longer available, so try adding this other parameter:
VBA Code:
.Shape.TextFrame.AutoSize = True
 
Upvote 0
Thank you for the additional code. Unfortunately, I got a Run-time error '1004': Application-defined or object-defined error". First I added this code at the beginning of the "With cmt", run the script then moved it to the end just in case it makes a difference but it did not make a difference.
 
Upvote 0
Not sure since I don't have any experience with the Mac versione of Excel, so maybe, your 2019 MacOS doesn't accept this other parameter. Works fine with Windows version.
 
Upvote 0
Last go after a quick search in web, try this since it is common for 365 version (not for my 2016 version):
VBA Code:
.Shape.AutoSize = True
 
Upvote 0

Forum statistics

Threads
1,215,200
Messages
6,123,604
Members
449,109
Latest member
Sebas8956

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top