Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 11-08-2020, 09:21 PM
Cendrinne's Avatar
Cendrinne Cendrinne is offline Delete Table Rows with no highlighting Windows 10 Delete Table Rows with no highlighting Office 2019
Competent Performer
Delete Table Rows with no highlighting
 
Join Date: Aug 2019
Location: Montreal Quebec Canada
Posts: 190
Cendrinne is on a distinguished road
Default Delete Table Rows with no highlighting

Following on from https://www.msofficeforums.com/155435-post6.html, I'm manually deleting rows that has no highlights. This is tooo freaking long with 10K rows. There must be a macro. I'm trying to figure a way to delete table Rows, that has NO HIGHLIGHTS.

I don't want to go to bed at 4-5 in the morning and I can't figure it out. Do you have a ready scrpit that I could use.

I'm sooo sorry to ask. I'm not that bad, but not as good as you pro's.



Cendrinne
Reply With Quote
  #2  
Old 11-08-2020, 09:33 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: 21,956
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

So basically, you only want to keep the rows that have just 'Inc.' or 'Ltd.' in one of the cells? In which column are those highlighted cells to be found?
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 11-08-2020, 09:35 PM
Cendrinne's Avatar
Cendrinne Cendrinne is offline Delete Table Rows with no highlighting Windows 10 Delete Table Rows with no highlighting Office 2019
Competent Performer
Delete Table Rows with no highlighting
 
Join Date: Aug 2019
Location: Montreal Quebec Canada
Posts: 190
Cendrinne is on a distinguished road
Default

Well actually, I've highlighted other items to correct, so I was looking for a script that if there is any items highlighted in a row, Keep, but DELETE all other rows, if there is NO Hightlights.

I'm still searching google and Bing, but coming up empty.

Or if a table row of 2 columns, has NO HIGHLIGHTED COLOR, delete the content of the row, I do have a macro to delete empty rows. If that would be easier.

Cendrinne
Reply With Quote
  #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: 21,956
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
  #5  
Old 11-08-2020, 10:40 PM
Cendrinne's Avatar
Cendrinne Cendrinne is offline Delete Table Rows with no highlighting Windows 10 Delete Table Rows with no highlighting Office 2019
Competent Performer
Delete Table Rows with no highlighting
 
Join Date: Aug 2019
Location: Montreal Quebec Canada
Posts: 190
Cendrinne is on a distinguished road
Default

WOW WOW WOW, Paul, I don't know what you did, but it's P E R F E C T. Wow, I'll try to analyze another time, how you did that, cause now I'm too tired but wow is the only word I can say

Thank you a million
Reply With Quote
  #6  
Old 11-08-2020, 10:47 PM
Cendrinne's Avatar
Cendrinne Cendrinne is offline Delete Table Rows with no highlighting Windows 10 Delete Table Rows with no highlighting Office 2019
Competent Performer
Delete Table Rows with no highlighting
 
Join Date: Aug 2019
Location: Montreal Quebec Canada
Posts: 190
Cendrinne is on a distinguished road
Default

Just to let you know, it works so well, that I've tried to put on column 1 a highlighted cell, but not the other, then on many rows below I've tested to put on Column 2 a highlighted cell, but not on the first, and it did amazingly as the previous test

So that is amazing

Night smart man
Reply With Quote
  #7  
Old 11-08-2020, 11:09 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: 21,956
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

Yes, I coded it so it doesn't matter which column has the highlighting - or how many columns there are.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #8  
Old 11-13-2020, 09:25 AM
Cendrinne's Avatar
Cendrinne Cendrinne is offline Delete Table Rows with no highlighting Windows 10 Delete Table Rows with no highlighting Office 2019
Competent Performer
Delete Table Rows with no highlighting
 
Join Date: Aug 2019
Location: Montreal Quebec Canada
Posts: 190
Cendrinne is on a distinguished road
Default

Smart thank you
Reply With Quote
Reply

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 03:27 AM.


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