Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #3  
Old 03-18-2017, 09:17 AM
Logit Logit is offline delete rows not containing certain text Windows 10 delete rows not containing certain text Office 2007
Expert
 
Join Date: Jan 2017
Posts: 591
Logit is a jewel in the roughLogit is a jewel in the roughLogit is a jewel in the roughLogit is a jewel in the rough
Default

Code:
Option Explicit

Sub DeleteRowNoInclude()
'Update20140618
Dim xRow As Range
Dim rng As Range
Dim WorkRng As Range
Dim xStr As String
Dim i As Integer
On Error Resume Next
Set WorkRng = Application.Selection
Set WorkRng = Application.InputBox("Range", WorkRng.Address, Type:=8)
xStr = Application.InputBox("Text", Type:=2)
Application.ScreenUpdating = False
For i = WorkRng.Rows.Count To 1 Step -1
    Set xRow = WorkRng.Rows(i)
    Set rng = xRow.Find(xStr, LookIn:=xlValues)
        
    If Not rng Is Nothing Then
       xRow.Delete
    End If
Next
Application.ScreenUpdating = True
End Sub
Attached Files
File Type: xlsm Delete Row.xlsm (15.5 KB, 25 views)
 



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