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

up to 54, thanks

2
Contributors
4
Replies
16
Views
3 Years
Discussion Span
Last Post by imBaCodes
Featured Replies
  • 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 … Read More

  • 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 … Read More

1
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

Edited by imBaCodes: wrong answer

1
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..

Edited by imBaCodes: wrong anwer

0

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
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.