Hi all,
I am trying to create a macro which will merge the cells (A1:F1), then (G1:L1) and every 6 cells in the row from there on.
The code I am currently using is as follows:
However, I am getting a syntax error for the range reference. I'm sure it's a fairly basic mistake but I'm new to VBA so please bear with me. I realize data could be lost with the merge function but since its only going to be used on blank cells, I'm happy enough to use merge.
If someone could point out the correct way to reference the range I would appreciate it.
Thanks,
Opany
I am trying to create a macro which will merge the cells (A1:F1), then (G1:L1) and every 6 cells in the row from there on.
The code I am currently using is as follows:
Code:
Sub ColumnMerge()
Dim Range As Range
For x = 1 To 1000 Step 6
Range = (Cells(1, x), Cells(1, x + 5)).Merge
Next x
End Sub
However, I am getting a syntax error for the range reference. I'm sure it's a fairly basic mistake but I'm new to VBA so please bear with me. I realize data could be lost with the merge function but since its only going to be used on blank cells, I'm happy enough to use merge.
If someone could point out the correct way to reference the range I would appreciate it.
Thanks,
Opany