Sub 宏1()
'
' 宏1 宏
'
'
Dim test As String
Dim last As Integer
last = ActiveCell.Row + 3
Dim arr(9) As Variant
arr(0) = "A"
arr(1) = "B"
arr(2) = "C"
arr(3) = "D"
arr(4) = "E"
arr(5) = "F"
arr(6) = "G"
arr(7) = "H"
arr(8) = "I"
arr(9) = "J"
Dim i As Integer
For i = 0 To 9
test = arr(i)
Range(test & ActiveCell.Row & ":" & test & last).Select
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Selection.Merge
Next
End Sub
【vba】【excel】多个列向下合并n行单元格
最新推荐文章于 2024-04-26 15:44:16 发布