Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #13  
Old 03-19-2017, 01:31 PM
ewso ewso is offline delete rows not containing certain text Windows 10 delete rows not containing certain text Office 2016
Advanced Beginner
delete rows not containing certain text
 
Join Date: Nov 2016
Posts: 80
ewso is on a distinguished road
Default

Quote:
Originally Posted by NoSparks View Post
What you've pointed out in post #8 pretty much contradicts that, but here you go
Code:
Sub RowDoesNotContain()

Dim x As Long, ContainWord As String

'What phrase do you want to test for?
  ContainWord = "Magic"

With Sheets("Sheet1")    '<~~~ change as necessary
    For x = .Cells(Rows.Count, "A").End(xlUp).Row To 1 Step -1
        If Not Rows(x).Find(ContainWord) Is Nothing Then Rows(x).Delete
    Next x
End With

End Sub
thanks nosparks, but this is removing the rows that contain the specified text instead of removing the rows which do not contain the specified text.

edit: i removed the word 'Not' in the code and now it works fine.

thanks logit and nosparks.
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
delete rows not containing certain text Macro to delete rows not containing specific text Alimou Excel Programming 4 02-06-2017 07:35 AM
delete rows not containing certain text Delete blank rows between the two rows that contain data beginner Excel Programming 5 12-26-2014 12:29 AM
delete rows not containing certain text Delete All empty Rows - Print - Undo all Rows deleted Bathroth Word VBA 1 10-01-2014 01:40 PM
delete rows not containing certain text Delete Blank Rows (Cyrillic Text in Spreadsheet ) dozd Excel 1 02-22-2013 03:24 AM
delete rows not containing certain text Delete all rows but the last. elky1967 Word VBA 14 09-21-2012 05:27 AM

Other Forums: Access Forums

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