Sub d()
起始行 = 1
结束行 = 10
合并行数 = 3
合并列 = "b"
For I = 起始行 To 结束行 Step 合并行数
s = 合并列 & I & ":" & 合并列 & I + 合并行数 - 1
Range(s).Select
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = False
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
.MergeCells = True
End With
Next I
End Sub
'***********************************************************************'
word
Sub 合并单元格()
'
' 合并单元格 宏
'
'
合并行数 = Selection.Cells.Count
合并数 = 5
Selection.Cells.Merge
For i = 1 To 合并数 - 1 Step 1
Selection.MoveDown Unit:=wdLine, Count:=1
Selection.MoveDown Unit:=wdLine, Count:=合并行数 - 1, Extend:=wdExtend
Selection.Cells.Merge
Next i
'Dim t As Table
't = Selection.Cells.Parent
'E = Selection.Tables.Item(0).Rows.Count
End Sub