If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
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
|
|||
|
|||
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 |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Choosing a package, return all items | Teri | New Users | 10 | June 7th, 2006 03:34 PM |
Query is not updatable - | Doug Johnson via AccessMonster.com | Running & Setting Up Queries | 3 | January 21st, 2006 01:36 AM |
Need to Improve Code Copying/Pasting Between Workbooks | David | General Discussion | 1 | January 6th, 2006 04:56 AM |
Multiple Options Group | Patty Stoddard | Using Forms | 19 | August 4th, 2005 02:30 PM |
Improve the Address Book | Bill Molony | General Discussions | 10 | February 18th, 2005 12:49 AM |