我有一个未设置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如何增加像元高度。
请给我示例链接并放出。
答案 0 :(得分:0)
请勿使用合并单元格和自动拟合,而应使用自动换行,并将列宽设置为任何希望显示在数据上的数字。
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