怎么批量设置EXCEL中不同的行高和列宽
发布网友
发布时间:2022-02-21 11:25
我来回答
共3个回答
热心网友
时间:2022-02-21 13:11
常规的一般方法恐怕不行,用VBA吧。
Sub 自动行高列宽()
Dim i%, rng As Range
For i = 1 To 12 Step 2
Columns(i).ColumnWidth = 0.5
Columns(i + 1).ColumnWidth = 2
Rows(i).RowHeight = 5
Rows(i + 1).RowHeight = 15
With Cells(i + 1, i + 1)
.Borders(xlEdgeLeft).LineStyle = xlContinuous
.Borders(xlEdgeTop).LineStyle = xlContinuous
.Borders(xlEdgeBottom).LineStyle = xlContinuous
.Borders(xlEdgeRight).LineStyle = xlContinuous
End With
Next
For Each rng In Range("A1:L12")
s1 = rng.Column Mod 2
s2 = rng.Row Mod 2
If s1 = 0 And s2 = 0 Then
With rng
.Borders(xlEdgeLeft).LineStyle = xlContinuous
.Borders(xlEdgeTop).LineStyle = xlContinuous
.Borders(xlEdgeBottom).LineStyle = xlContinuous
.Borders(xlEdgeRight).LineStyle = xlContinuous
End With
End If
Next
End Sub
热心网友
时间:2022-02-21 14:46
先设置好2行2列就可以了,然后复制并右拉这2列,变成从A-O列的2行格式
再复制1-2行,复制并下拉到需要的行数,就是一个区域形成了。
若是需要再大些,则可复制A-O列,向后复制,就是整个很大的区域都是这样了格式了
热心网友
时间:2022-02-21 16:37
按Ctrl显示一个加号就可以