Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 09-01-2018, 11:53 PM
macropod's Avatar
macropod macropod is offline Merge the first row in a table Windows 7 64bit Merge the first row in a table Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,521
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Because your tables have merged cells, some circumlocution is required:
Code:
Sub Add_Rows_Table()
Application.ScreenUpdating = False
Dim Tbl As Table, Rng As Range
For Each Tbl In ActiveDocument.Tables
  With Tbl
    .Rows.Add
    Set Rng = .Range
    .Range.Cells(.Range.Cells.Count).Range.InsertBreak Type:=wdColumnBreak
    Rng.Tables(2).Range.Cells.Merge
    .Range.Characters.First.Previous.InsertBefore vbCr
    .Range.Characters.First.Previous.Previous.FormattedText = Rng.Tables(2).Range.FormattedText
    Rng.Tables(2).Delete
    .Range.Characters.First.Previous.Delete
    .Range.Characters.Last.Next.Delete
  End With
Next Tbl
Set Rng = Nothing
Application.ScreenUpdating = True
End Sub
You might find it interesting to step through the code...
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Merge the first row in a table How do I mail merge records into table columns with more than one merge field? tech123 Mail Merge 1 04-26-2017 07:13 PM
Merge the first row in a table Table Merge murazlan Mail Merge 3 11-21-2016 08:05 PM
Merge the first row in a table Merge only the text in a table and keep the 2 original colums of a table 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
Merge the first row in a table Merge Two Table in VBA donbexcel Word VBA 2 10-21-2011 11:46 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 09:10 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft