|
发表于 2016-2-29 11:26
|
显示全部楼层
本楼为最佳答案
Sub AdjustRowHeight()
Dim i, h, s As Long
Application.ScreenUpdating = False
Sheet1.Activate
For i = 5 To Cells(5, 1).End(xlDown).Row
' StaR = Sheet1.Cells(i, 4)
' h = 0
' For k = 1 To Len(StaR)
' If Mid(StaR, k, 1) = Chr(10) Then '计算字串中有几个换行
' h = h + 1
' End If
' Next
h = UBound(Split(Cells(i, 4), Chr(10)))
h = (h + 1) * 12.75
'如果行高不一致,则改变行高
If Rows(i).RowHeight <> 0 Then If Rows(i).RowHeight <> h Then Rows(i).RowHeight = (h + 1) * 12.75: s = s + 1
Next
Application.ScreenUpdating = True
MsgBox ("Done!" & Chr(10) & s & " Rows Changed")
End Sub
Test2.rar
(20.37 KB, 下载次数: 14)
|
|