[英]Autofit Row Height on Both: Column with Merged Cells AND Column with Single Cells
[英]VBA How to autofit row height with merged cells?
我有一個未在 data height 中設置的動態數據。 如何動態設置數據高度中的高度。
sub test()
Sheets(1).Cells(2, 16).Value = "Process inform HMI finish oil fiber display not show we check found HMI damage after we check no have spare after we move HMI alarm display at control spinning to install. But the type of HMI not same. To convert graphic display.After transfer to HMI and test operation finished. Test system with process is working normal. Process inform HMI finish oil fiber display not show we check found HMI damage after we check no have spare after we move HMI alarm display at control spinning to install. But the type of HMI not same. To convert graphic display.After transfer to HMI and test operation finished. Test system with process is working normal. Process inform HMI finish oil fiber display not show we check found HMI damage after we check no have spare after we move HMI alarm display at control spinning to install. But the type of HMI not same. To convert graphic display.After transfer to HMI and test operation finished. Test system with process is working normal. Process inform HMI finish oil fiber display not show we check found HMI damage after we check no have spare after we move HMI alarm display at control spinning to install. But the type of HMI not same. To convert graphic display.After transfer to HMI and test operation finished. Test system with process is working normal."
End sub
單元格數據完整數據顯示現在如何使用“WrapText”和“AutoFit”但完整數據顯示單元格但更多的是隱藏在單元格中的單詞。 行高 409 如何增加單元格高度。
給我示例鏈接並輸出。
不要使用合並單元格和自動調整,只使用換行文本並將列寬設置為任何所需的數字,這在您的數據上看起來不錯。
Sub test()
Dim row_num
Dim col_num
row_num = 2
col_num = 16
Columns(col_num).ColumnWidth = 65
Sheets(1).Cells(row_num, col_num).Value = "Process inform HMI finish oil fiber display not show we check found HMI damage after we check no have spare after we move HMI alarm display at control spinning to install. But the type of HMI not same. To convert graphic display.After transfer to HMI and test operation finished. Test system with process is working normal. Process inform HMI finish oil fiber display not show we check found HMI damage after we check no have spare after we move HMI alarm display at control spinning to install. But the type of HMI not same. To convert graphic display.After transfer to HMI and test operation finished. Test system with process is working normal.Process inform HMI finish oil fiber display not show we check found HMI damage after we check no have spare after we move HMI alarm display at control spinning to install. But the type of HMI not same.To convert graphic display.After transfer to HMI and test operation finished." _
& "Test system with process is working normal. Process inform HMI finish oil fiber display not show we check found HMI damage after we check no have spare after we move HMI alarm display at control spinning to install. But the type of HMI not same. To convert graphic display.After transfer to HMI and test operation finished. Test system with process is working normal."
Sheets(1).Cells(row_num, col_num).WrapText = True
End Sub
編輯版本
您可以檢查以下代碼以獲取自動擬合合並單元格。
列 A 到 C 的單元格寬度分別設置為 12,對於高度,文本長度的 45% 的比例取決於此寬度,如果您想更改寬度,您也必須更改比例。
Sub test1()
Sheets(1).Cells(2, 1).Value = " Testing Testing TestingTestingTesting Testing Testing TestingTestingTesting Testing TestingTesting Testing Testing TestingTesting Testing Testing Testing TestingTesting Testing TestingTesting Testing Testing Testing Testing Testing Testing Testing TestingTestingTesting Testing"
Range("A2:C2").Merge
Range("A2:C2").WrapText = True
Columns("A:C").ColumnWidth = 12
text_length = Len(Sheets(1).Cells(2, 1).Value)
Rows("2:2").RowHeight = text_length * 0.45
End Sub
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.