xlWSheet.Range("C19:K19").Merge
xlWSheet.Range("C20:K20").Merge
xlWSheet.Range("C21:K21").Merge
xlWSheet.Range("C22:K22").Merge

up to 54, thanks

Sub MergeLoop()
Dim C As Integer
Dim K As Integer

C = 19
K = 19


cnt = 1

Do While C <= 54
Range("C" & C & ":" & "K" & K).Select
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Selection.Merge
C = C + 1
K = K + 1
Loop

End Sub

Try this ..

happy coding

Sub MergeLoop()
cnt = 19
Do While cnt <= 54
Range("C" & cnt & ":" & "K" & cnt).Select
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Selection.Merge
cnt = cnt + 1
Loop

End Sub

You also try it like this..

this worked, thanks for the idea

Dim cc As Integer, kc As Integer
cc = 19
kc = 19

Do While cc <= 54 And kc <= 54
    xlWSheet.Range("C" & cc & ":" & "K" & kc).Merge
    cc = cc + 1
    kc = kc + 1
Loop

happy coding ..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.