View Single Post
 
Old 02-17-2012, 12:53 PM
KD999 KD999 is offline Windows XP Office 2007
Novice
 
Join Date: Feb 2012
Posts: 4
KD999 is on a distinguished road
Default Macro to Merge Cells Row By Row in a Table

Hi,

I need help creating a macro which will merge particular cells within a table for multiple rows but leave the rows separate.

In my table I've got 8 columns and 20 rows. In each of the 20 rows I want to merge the data in columns 2, 3 & 4.

I've picked up the following macro which will merge the Cells but I need it to loop through the rest of the table.

Sub MergeCellsRowByRow()
'
' MergeCellsRowByRow Macro
'
'
Dim myCells As Range
Dim r As Row
With ActiveDocument
Set myCells = .Range(Start:=.Tables(1).Cell(1, 2).Range.Start, End:=.Tables(1).Cell(1, 4).Range.End)
myCells.Select
End With

Selection.Cells.Merge

End Sub

Thanks in advance
Reply With Quote