ページ

2009年2月19日木曜日

【vbs】セルの結合

Sub セルの結合5()
'
' 5セル結合します
'
Dim n As Integer
n = 4 '結合数
Do While Not (ActiveCell.Value = 0)
Selection.Resize(1, n).Select
Selection.Merge
ActiveCell.Offset(1).Select
Loop
End Sub

Sub セルの結合()
'
' セルを結合して一つ下へ移動します。
With Selection
.HorizontalAlignment = xlCenter
End With
Selection.Merge
ActiveCell.Offset(1).Select
End Sub

0 件のコメント: