跳到主要內容

如何自動調整註釋框的大小以適合Excel中的內容?

當您將註釋插入單元格時,註釋框的大小是默認值。 如果您在其中輸入很多內容,則某些內容將不會直接可見。 是否可以自動使註釋框的大小適合其內容?

自動調整註釋框的大小以使其適合工作表中的內容
自動調整註釋框大小以使其內容適合一系列單元格
輕鬆自動調整註釋框大小,以使用出色的工具將其內容適合活動工作表或所有工作表


自動調整註釋框的大小以使其適合工作表中的內容

在Excel中,您可以將註釋框手動一一拖到您需要的大小,但是如果有很多註釋框需要調整大小,這種方式將很繁瑣且耗時。 在這種情況下,您可以應用以下VBA代碼。

1.按住 ALT + F11 鍵,然後打開 Microsoft Visual Basic for Applications窗口.

2。 點擊 插入 > 模塊,然後將以下宏粘貼到 模塊窗口.

VBA代碼:自動調整工作表中的註釋框的大小

Sub FitComments()
'Updateby20140325
Dim xComment As Comment
For Each xComment In Application.ActiveSheet.Comments
    xComment.Shape.TextFrame.AutoSize = True
Next
End Sub

3.然後按 F5 鍵以運行此代碼,並且活動工作表中的所有註釋框都已調整大小以適合其內容,如以下屏幕截圖所示:

doc自動調整大小comment1

尖端:此代碼僅在當前工作表中起作用,並且無法自動調整您添加的新註釋框的大小。


一鍵快速將註釋框的大小自動調整為適合Excel中的內容:

自動評論 的效用 Excel的Kutools 可以幫助在工作表中自動將註釋框的大小自動調整為其內容,如下面的演示所示。 立即下載並試用! (30 天免費試用)


自動調整註釋框大小以使其內容適合一系列單元格

如果只需要自動調整單元格註釋框的大小,則可以使用以下VBA代碼。

1.按住 ALT + F11 鍵,然後打開 Microsoft Visual Basic for Applications窗口.

2。 點擊 插入 > 模塊,然後將以下宏粘貼到 模塊窗口.

VBA代碼:在一系列單元格中自動調整註釋框的大小

Sub Fitrangecomments()
'Updateby20140325
Dim rng As Range
Dim WorkRng As Range
xTitleId = "KutoolsforExcel"
Set WorkRng = Application.Selection
Set WorkRng = Application.InputBox("Range", xTitleId, WorkRng.Address, Type:=8)
For Each rng In WorkRng
    If Not rng.Comment Is Nothing Then
        rng.Comment.Shape.TextFrame.AutoSize = True
    End If
Next
End Sub

3.然後按 F5 鍵以執行此代碼,然後會出現一個提示框,提醒您選擇要調整註釋框大小的單元格範圍,請參見屏幕截圖:

文檔調整大小評論框3

4.然後單擊 OK,您選擇的單元格註釋框已自動適應註釋內容。

尖端:此代碼無法自動調整您添加的新註釋框的大小。


自動調整註釋框大小以使其內容適合活動工作表或所有工作表 

你可以試試 自動調整評論 的效用 Excel的Kutools 自動調整大小活動工作表中的所有註釋框或Excel中的所有工作表。 請執行以下操作。

申請前 Excel的Kutools首先下載並安裝.

1.要自動調整註釋框的大小以使其適合活動表中的內容,請單擊 庫工具 > 更多 > 自動調整評論 > 活動表.

如果要自動調整整個工作簿中所有註釋框的大小,請單擊 庫工具 > 更多 > 自動調整評論 > 所有工作表。 看截圖:

然後,所有評論框都會自動調整大小以適合其內容。 看截圖:

筆記:

  • 1.自動調整註釋框的大小後,再次編輯註釋時,註釋框將隨內容自動擴展或縮小。
  • 2.對於您插入的新註釋,您需要再次啟用此AutoFit註釋實用程序以調整所有新插入的註釋框的大小。

  如果您想免費試用(30天)此實用程序, 請點擊下載,然後按照上述步驟進行操作。


輕鬆自動調整註釋框大小以適合其內容


相關文章:

最佳辦公生產力工具

🤖 Kutools 人工智慧助手:基於以下內容徹底改變數據分析: 智慧執行   |  生成代碼  |  建立自訂公式  |  分析數據並產生圖表  |  呼叫 Kutools 函數...
熱門特色: 尋找、突出顯示或識別重複項   |  刪除空白行   |  合併列或儲存格而不遺失數據   |   沒有公式的回合 ...
超級查詢: 多條件VLookup    多值VLookup  |   跨多個工作表的 VLookup   |   模糊查詢 ....
高級下拉列表: 快速建立下拉列表   |  依賴下拉列表   |  多選下拉列表 ....
欄目經理: 新增特定數量的列  |  移動列  |  切換隱藏列的可見性狀態  |  比較範圍和列 ...
特色功能: 網格焦點   |  設計圖   |   大方程式酒吧    工作簿和工作表管理器   |  資源庫 (自動文字)   |  日期選擇器   |  合併工作表   |  加密/解密單元格    按清單發送電子郵件   |  超級濾鏡   |   特殊過濾器 (過濾粗體/斜體/刪除線...)...
前 15 個工具集12 文本 工具 (添加文本, 刪除字符,...)   |   50+ 圖表 類型 (甘特圖,...)   |   40+ 實用 公式 (根據生日計算年齡,...)   |   19 插入 工具 (插入二維碼, 從路徑插入圖片,...)   |   12 轉化 工具 (數字到單詞, 貨幣兌換,...)   |   7 合併與拆分 工具 (高級合併行, 分裂細胞,...)   |   ... 和更多

使用 Kutools for Excel 增強您的 Excel 技能,體驗前所未有的效率。 Kutools for Excel 提供了 300 多種進階功能來提高生產力並節省時間。  點擊此處獲取您最需要的功能...

產品描述


Office選項卡為Office帶來了選項卡式界面,使您的工作更加輕鬆

  • 在Word,Excel,PowerPoint中啟用選項卡式編輯和閱讀,發布者,Access,Visio和Project。
  • 在同一窗口的新選項卡中而不是在新窗口中打開並創建多個文檔。
  • 將您的工作效率提高 50%,每天為您減少數百次鼠標點擊!
Comments (19)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Hi. I've been using an xls spreadsheet for 10+ years. Suddenly, all my note boxes were hugely expanded, showed as a blank note until I edited them. Your solution below worked to resize all of my note boxes to fit contents. But now when I try to resize the note box to add more text, Excel crashes. This is even after I saved as an xlsx file to remove all VB code. Can you help?

Sub FitComments()
'Updateby20140325
Dim xComment As Comment
For Each xComment In Application.ActiveSheet.Comments
xComment.Shape.TextFrame.AutoSize = True
Next
End Sub
This comment was minimized by the moderator on the site
Bom-dia,

Salvou de mais! Após abrir planilha no celular todos os comentários ficaram desajustados no pc.
Tinha mais de 10 mil comentários pra arrumar o tamanho da caixa! Se tivesse pix eu até pagava! Obrigado.
This comment was minimized by the moderator on the site
It doesn't work, the insert module does not show up
This comment was minimized by the moderator on the site
amazing! thank you, the first way works! saved me hours of work!
This comment was minimized by the moderator on the site
I guess Crystal got us off track the question was: Is there a way of making the line from the comment box to the cell darker or fatter? That would be the line surrounding the comment box. TIA DD
This comment was minimized by the moderator on the site
Is there a way of making the line from the comment box to the cell darker or fatter?
This comment was minimized by the moderator on the site
Hi Demondrew,
Sorry can help you for that.
This comment was minimized by the moderator on the site
Thank you so much for sharing this. Really helpful!
This comment was minimized by the moderator on the site
@DENNIE "While the code works it makes the box one line high meaning that large comments disappear off-page somewhere. Could you give the code for fixing the width of each box (to let's say three standard Excel column widths) and auto-adjusting the length of the box to fit the text? Thanks." // Agreed
This comment was minimized by the moderator on the site
Thank you very much. This really saved me from lots of hassles.
This comment was minimized by the moderator on the site
While the code works it makes the box one line high meaning that large comments disappear off-page somewhere. Could you give the code for fixing the width of each box (to let's say three standard Excel column widths) and auto-adjusting the length of the box to fit the text? Thanks.
There are no comments posted here yet
Load More
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations