Link to home
Start Free TrialLog in
Avatar of mike637
mike637Flag for United States of America

asked on

Merge cells in range

Hello Experts,

I thought I knew what I was doing - but NO.  I am trying to merge cells quickly.
On my sheet I have Range("K7:BA7") that I need to merge. (K7&L7, then M7&N7 etc.)

Here is my code:

   Dim i As Long

   For i = 11 To 45 Step 2
   Sheet7.range(cells(7, i), cells(7, i + 1)).merge
   Next i

However I am getting an error code 1004 - I do not know what I am doing wrong.

Can you please correct me which will educate me, as well.

Thank you!
ASKER CERTIFIED SOLUTION
Avatar of YDs60
YDs60
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mike637

ASKER

You are right - thanks for checking, so the points are yours.  I was being stupid and did not have it in a module but was trying to initiate from another worksheet routine.

I will remember next time.  I knew this, I just forgot.