Excel: Merging blank cells
Sub MergeBlanks()
' Merge blank cells with the cell above it
' You need to select the range first.
Dim cell As Range
Dim sel As Range
Set sel = Application.selection
For Each cell In selection
Debug.Print sel.Columns(sel.Rows.Count).Row
If cell.Row <= sel.Columns(sel.Rows.Count).Row Then
If Cells(cell.Row + 1, cell.Column).Value = "" Then
Debug.Print cell.Row; " "; cell.Column
ActiveSheet.Range(Cells(cell.Row, cell.Column), Cells(cell.Row + 1, cell.Column)).Merge
End If
End If
Next
End Sub