Consulting

Results 1 to 2 of 2

Thread: VBA To Size Comment Boxes In MS Excel 2016 For Mac High Sierra?

  1. #1

    VBA To Size Comment Boxes In MS Excel 2016 For Mac High Sierra?

    Can someone show how to set the size all the worksheet comments boxes in MS Excel 2016 to fit their comments?

    In MS Excel 2011, I used the following VBA statements. The red font statement generates an error in MS Excel 2016.

    Dim Commnt As Comment
    For Each Commnt In Application.ActiveSheet.Comments                
        ' Autosize all comment boxes on the sheet
        Commnt.Shape.TextFrame.AutoSize = True
        Next
    '



    Last edited by Aussiebear; 01-04-2025 at 12:35 PM.

  2. #2
    Moderator VBAX Wizard Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    5,293
    Location
    Maybe try the following

    Sub ResizeAllComments()
        Dim xComment As Comment
        For Each xComment In Application.ActiveSheet.Comments    ' **Crucial for Mac:** 
            '   - Clear existing AutoSize settings to ensure consistent behavior.
            '   - Set AutoSize to False before manual sizing.
            xComment.Shape.AutoSize = False 
            ' Adjust width and height as needed. 
            ' Example:
            xComment.Shape.Width = 200
            xComment.Shape.Height = 100 
        Next xComment
    End Sub
    Remember To Do the Following....
    Use [Code].... [/Code] tags when posting code to the thread.
    Mark your thread as Solved if satisfied by using the Thread Tools options.
    If posting the same issue to another forum please show the link

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •