Group:  Microsoft Word ยป microsoft.public.word.tables
Thread: Merging Cells

DotNetBag
.NET Development Newsgroups

HTVi
TV Discussion Newsgroups

Our Hot Pick: Rising Antivirus 2006 - Certified by TUV & Checkmark! Get 10% discount by entering this coupon code: ONDISCOUNT10
Rising Antivirus 2006

Merging Cells
"Michael" <info[ at ]homekeyinc.com> 03.08.2006 20:14:08
Hi Folks - I have a large table column like this:

Text
Blank
Text
Blank

I need to merge every two rows. So, now I have 100 rows, the end result will
be 50 rows. I know I can do this manually, but I have about 20 tables with
100 rows. Any ideas?

Thanks,

Michael



Re: Merging Cells
Cindy M -WordMVP- <C.Meister-C[ at ]hispeed.ch> 05.08.2006 09:17:30
Hi Michael,

[Quoted Text]
> have a large table column like this:
>
> Text
> Blank
> Text
> Blank
>
> I need to merge every two rows. So, now I have 100 rows, the end result will
> be 50 rows. I know I can do this manually, but I have about 20 tables with
> 100 rows. Any ideas?
>
See if a macro like this helps (only tested on a smallish table)

Sub MergeEverySecondCell()
Dim tbl As Word.Table
Dim counter As Long
Dim col As Word.Column
Dim celLower As Word.Cell
Dim celUpper As Word.Cell

Set tbl = ActiveDocument.Tables(1)
counter = 1
Set col = tbl.Columns(1)
Do While counter < col.Cells.Count
Set celLower = col.Cells(counter)
counter = counter + 1
Set celUpper = col.Cells(counter)
celLower.Merge celUpper
Loop
End Sub


Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :-)

Home | Search | Terms | Imprint | Contact
Newsgroups Reader - provided by WiredBox.Net