I have inserted a table with 5 rows en 17 columns using a macro. Now I want
to merge certain cells, for example : I n row1, I want to merge cells 1 to 5.
And in row 2, I want to merge cells 2 to cell 5. and further. I know in
advance which cells from a particular row need to be merged.
Is there some VBA code for this?
Thanks for the contribution
The following adds such a table at the location of the selection and then
merges those cells:
Dim mytable As Table, myrange As Range
Set mytable = ActiveDocument.Tables.Add(Range:=Selection.Range, NumRows:=17,
NumColumns:=5)
Set myrange = mytable.Cell(1, 1).Range
myrange.End = mytable.Cell(1, 5).Range.End
myrange.Cells.Merge
Set myrange = mytable.Cell(2, 2).Range
myrange.End = mytable.Cell(2, 5).Range.End
myrange.Cells.Merge

Signature
Please respond to the Newsgroup for the benefit of others who may be
interested. Questions sent directly to me will only be answered on a paid
consulting basis.
Hope this helps,
Doug Robbins - Word MVP
>I have inserted a table with 5 rows en 17 columns using a macro. Now I want
> to merge certain cells, for example : I n row1, I want to merge cells 1 to
[quoted text clipped - 5 lines]
>
> Thanks for the contribution
vicenflor - 26 Feb 2005 22:11 GMT
Thanks Doug,
The code runs fine!
> The following adds such a table at the location of the selection and then
> merges those cells:
[quoted text clipped - 18 lines]
> >
> > Thanks for the contribution