Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #4  
Old 04-07-2021, 04:50 PM
macropod's Avatar
macropod macropod is offline Adding new rows to a table Windows 10 Adding new rows to a table Office 2016
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

Whilst I agree with Andrew regarding the desirability of avoiding double rows, I think a macro can also be made to replicate the structure fairly reliably where such avoidance isn't practical. For example:
Code:
Sub Demo()
Application.ScreenUpdating = False
Dim RngSrc As Range, RngTgt As Range
With Selection
  If .Information(wdWithInTable) = False Then Exit Sub
  With .Tables(1)
    Set RngSrc = .Rows(.Rows.Count - 1).Range
    RngSrc.End = .Range.End
    Set RngTgt = .Range
    RngTgt.Collapse wdCollapseEnd
    RngTgt.FormattedText = RngSrc.FormattedText
    .Rows(.Rows.Count - 1).Range.Delete
    .Rows(.Rows.Count - 1).Cells(1).Range.Text = (.Rows.Count - 1) / 2
  End With
End With
Application.ScreenUpdating = True
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
 

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA Adding Rows To Table With Content Control lord_kaiser Word VBA 2 08-01-2020 01:01 AM
Adding new rows to a table Add Rows to table that will include content controls of previous rows bobsagat Word VBA 20 01-27-2020 08:00 AM
Adding new rows to a table Adding Rows to a Table SuzeG Word VBA 8 01-02-2014 08:05 AM
Adding new rows to a table Grouping table rows to prevent individual rows from breaking across pages dennist77 Word 1 10-29-2013 11:39 PM
Adding new rows to a table adding rows to word table hklein Word VBA 4 07-18-2011 12:21 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 03:18 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