Search code examples
excelvbamergerangecell

Merge Function with Range and Cells


I am trying to merge cells in a loop:

WS1.Range(.Cells(2, 2 + ((i - 1) * 9)), .Cells(2, 2 + ((i - 1) * 9) + 5)).Merge

but is not working; what is the correct way to do that?


Solution

  • WS1.Range(WS1.Cells(2, 2 + ((i - 1) * 9)), WS1.Cells(2, 2 + ((i - 1) * 9) + 5)).Merge