やりたいこと
文字セル→空白行(複数個)→文字セル→空白行と続く列について、空白セルを文字セルに結合する。
イメージは、こんな感じ↓
使い方
上記ルールで結合したいセル範囲を選択します。
その状態で、Alt+8からマクロを実行します。
ソースコード
module1
Public Sub chrMerge()
Dim rngSel As Range, rng As Range
If TypeName(Selection) <> "Range" Then Exit Sub 'エラー処理
Set rngSel = Selection
For Each rng In rngSel
If rng.Text <> "" Then
Do While rng.Offset(1, 0).Text = ""
If Intersect(rng.Offset(1, 0), rngSel) Is Nothing Then Exit Do
Range(rng, rng.Offset(1, 0)).Merge
Loop
End If
Next
Set rngSel = Nothing
End Sub