programatically merge cells?

  • Thread starter Thread starter David Bateman
  • Start date Start date
D

David Bateman

I am using Microsoft Excel 2000. How can I write a macro which will
automatically merge every three cells in Row 10. That is merge column a, b,
c, then d, e, f etc.


Thanks in advance,
db
 
db,

Sub TryNow()
Dim i As Integer
For i = 0 To 84
Cells(10, i * 3 + 1).Resize(1, 3).Merge
Next i
End Sub

The last cell on row 10 won't be merged....

HTH,
Bernie
MS Excel MVP
 
one way:

Public Sub Merge3In10()
Dim i As Long
For i = 1 To Columns.Count - 3 - (Columns.Count Mod 3) Step 3
Cells(10, i).Resize(1, 3).Merge
Next i
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top