Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.tables
|
|||
|
|||
Address Table Header Rows
I have a number of tables that are created from merging Excel data I am
looking for a way to go through the document and when ever the first column last name changes from A to B and B to C I would like to insert a new row, merging all the cells with the new Alpha character centered, Bolded, and the cell bordered on the outside. Any suggestions greatly appreciated. --- Regards Michael Koerner |
#2
Posted to microsoft.public.word.tables
|
|||
|
|||
Address Table Header Rows
The following macro should do what you want as long as the Lastname is the
first word in the cells of the first column. Dim i As Long Dim mytable As Table Dim lname As Range Dim Initial As String Dim Alpha As String Dim newrow As Row Set mytable = ActiveDocument.Tables(1) Alpha = " " With mytable For i = 1 To .Rows.Count Set lname = .Cell(i, 1).Range Initial = Left(lname.Text, 1) If Initial Alpha Then Alpha = Initial Set newrow = mytable.Rows.Add(BeforeRow:=mytable.Rows(i)) newrow.Cells.Merge newrow.Range.Text = Alpha newrow.Range.Paragraphs(1).Alignment = wdAlignParagraphCenter newrow.Range.Font.Bold = True i = i + 1 End If Next i End With -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP "Michael Koerner" wrote in message ... I have a number of tables that are created from merging Excel data I am looking for a way to go through the document and when ever the first column last name changes from A to B and B to C I would like to insert a new row, merging all the cells with the new Alpha character centered, Bolded, and the cell bordered on the outside. Any suggestions greatly appreciated. --- Regards Michael Koerner |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Problem pasting landscape table rows | Page Layout | |||
Headers and Footers in Main Body with Table Breaks | Page Layout | |||
Protected table header | Tables | |||
Preventing deletion of header | Microsoft Word Help | |||
Remove Rows from a Table after merging | Mailmerge |