![]() |
#1
|
|||
|
|||
![]()
I'm converting PDFs to Word and most tables in the document have merged rows, but not sure how many columns. They all differ.
I'm adding a row to the top of the table, but then it needs to be merged. I've found the macro to add the row, but can't find how to merge it to the entire row. I did find a macro to merge, by only the first two columns. How can I find the end of the table for the first row to merge the first row no matter how many columns? Code:
Sub Add_Rows_Table() Application.ScreenUpdating = False Dim Tbl As Table, Rng As Range For Each Tbl In ActiveDocument.Tables Tbl.Cell(1, 1).Range.Select Selection.InsertRowsAbove 1 Next Tbl Application.ScreenUpdating = True End Sub Code:
Sub Test_This() Dim mrgrng As Range With Selection.Tables(1) Set mrgrng = .Cell(1, 1).Range mrgrng.End = .Cell(1, 2).Range.End mrgrng.Cells.Merge End With End Sub Note: It seems the overall problem is the vertically merged cells. I can't seem to find how to work around the vertically merged cell to format the newly added first row of the table. Last edited by jeffreybrown; 09-01-2018 at 07:47 AM. |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
tech123 | Mail Merge | 1 | 04-26-2017 07:13 PM |
![]() |
murazlan | Mail Merge | 3 | 11-21-2016 08:05 PM |
![]() |
james1979uk | Word Tables | 5 | 12-15-2013 05:48 PM |
Cannot Merge Into A Table | MacDee | Mail Merge | 1 | 01-29-2013 07:21 PM |
![]() |
donbexcel | Word VBA | 2 | 10-21-2011 11:46 AM |