excel VBA列宽调整
请教各位大虾:
excel中有若干不等宽列,怎样实现它们列等宽并且总列宽等于原来的列宽?
感谢。
[解决办法]
Sub average()
Dim i, k, widths, widthaver As Long
k = 0
widths = 0
For i = sheet1_startrow To sheet1_endrow
widths = i.ColumnWidth + widths
k = k + 1
Next i
widthaver = widths / k
For i = sheet1_startrow To sheet1_endrow
i.ColumnWidths = widthaver
Next i
End Sub