billandrew
Well-known Member
- Joined
- Mar 9, 2014
- Messages
- 743
Looking to merge 2 cells in Range if there is data.
i.e.
Columns F:G
Columns I:J
i.e.
Columns F:G
Columns I:J
Sub mergeColumns()
Dim rng1 As Range
Dim rng2 As Range
Dim rng3 As Range
Application.ScreenUpdating = False
lr = Cells(Rows.Count, 6).End(xlUp).Row
For i = 9 To lr
Set rng1 = Range(Cells(i, 6), Cells(i + 1, 7))
With rng1
.HorizontalAlignment = xlCenterAcrossSelection
.VerticalAlignment = xlCenter
.WrapText = True
End With
Set rng2 = Range(Cells(i, 9), Cells(i + 1, 10))
With rng2
.HorizontalAlignment = xlCenterAcrossSelection
.VerticalAlignment = xlCenter
.WrapText = True
End With
Set rng3 = Range(Cells(i, 11), Cells(i + 1, 13))
With rng3
.HorizontalAlignment = xlCenterAcrossSelection
.VerticalAlignment = xlCenter
.WrapText = True
End With
Next i
Application.ScreenUpdating = True
Cells(1, 1).Select
End Sub