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

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
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,224,819
Messages
6,181,153
Members
453,021
Latest member
Justyna P

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