Skip to main content

单元格格式


'此示例需要准备 三个工作簿 sheet1~3

Sub 单元格基础格式()

For i = 1 To 3

Worksheets("sheet" & i).Select

Set biaoti = Range("B2:G2")

'合并B2到G2单元格
biaoti.Merge

'文本居中
biaoti.HorizontalAlignment = xlCenter

'颜色字体边框加粗等设置
Set biaotou = Range("B4:G4")
biaotou.HorizontalAlignment = xlCenter
biaotou.Font.Size = 12
biaotou.Font.ColorIndex = 1
biaotou.Font.Bold = True
biaotou.Interior.ColorIndex = 15

Range("B4:G10").Borders.LineStyle = True

Next i

End Sub