我有一张excel工作簿,大约有150张。 有没有办法找到最宽的列(在本例中为C列),然后设置Column" C"在每张表中工作簿到这个宽度? 提前致谢 查兹
答案 0 :(得分:0)
Sub Main
Dim cell As Range
Dim maxWidth As Long
Dim sht As Worksheet
For Each sht in Worksheets
For Each cell In sht.UsedRange.Rows(1)
If cell.Width > maxWidth Then maxWidth = cell.Width
Next cell
Next sht
For Each sht in Worksheets
sht.Columns("C").ColumnWidth = maxWidth
Next sht
End Sub