Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #4  
Old 11-08-2020, 10:06 PM
macropod's Avatar
macropod macropod is offline Delete Table Rows with no highlighting Windows 10 Delete Table Rows with no highlighting Office 2010
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
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

Perhaps:
Code:
Sub Demo()
Application.ScreenUpdating = False
Dim RngFnd As Range, RngDel As Range
With Selection.Tables(1)
  Set RngFnd = .Range: Set RngDel = .Range
  RngDel.Collapse wdCollapseStart
  With .Range
    With .Find
      .ClearFormatting
      .Replacement.ClearFormatting
      .Text = ""
      .Replacement.Text = ""
      .Forward = True
      .Wrap = wdFindStop
      .Highlight = True
      .Format = True
      .MatchWildcards = False
    End With
    Do While .Find.Execute
      If .InRange(RngFnd) = False Then Exit Do
      If .Cells(1).RowIndex > RngDel.Cells(1).RowIndex Then
        RngDel.End = .Tables(1).Cell(.Cells(1).RowIndex - 1, 1).Range.End
        RngDel.Rows.Delete
      End If
      RngDel.Start = .Tables(1).Rows(.Cells(1).RowIndex).Range.End + 1
      .End = .Cells(1).Range.End
      If .Information(wdAtEndOfRowMarker) = True Then .End = .End + 1
      .Collapse wdCollapseEnd
    Loop
  End With
  If RngDel.Information(wdWithInTable) = True Then
    If RngDel.Cells(1).RowIndex <= .Rows.Count Then
      RngDel.End = .Range.End
      RngDel.Rows.Delete
    End If
  End If
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
Delete Table Rows with no highlighting Delete rows when copying table kippiebla Excel Programming 4 05-10-2020 12:18 AM
Delete Table Rows with no highlighting Macro delete table rows if cell in first column = $ Btop Word VBA 7 02-13-2018 05:36 PM
Delete Table Rows with no highlighting Delete Empty Table Rows cltay87 Word VBA 4 02-27-2017 04:23 AM
Delete Table Rows with no highlighting How to delete the two non-adjacent rows in a table Word beginner Word 2 01-05-2015 05:47 AM
Delete Table Rows with no highlighting Delete Rows in Protected Table with Form Fields Elan05 Word VBA 23 09-11-2014 12:47 PM

Other Forums: Access Forums

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