|
Option Explicit
'Range.Merge 方法
'由指定的 Range 对象创建合并单元格。
Sub 合并单元格()
Selection.Merge
End Sub
Sub 合并单元格实例()
Dim er%, rng%, rg As Range
Application.DisplayAlerts = False
er = Application.CountA([a:a])
For rng = er To 2 Step -1
Set rg = Range("a" & rng)
If rg = rg.Offset(-1) Then rg.Offset(-1).Resize(2).Merge
Next
Application.DisplayAlerts = True
End Sub
|
|