![]() |
#5
|
|||
|
|||
![]()
The macro will do what you are seeking. Remove the word Not from the
macro line as indicated, then run the code. The two Input Boxes that appear give you much more range to do what you want without having to constantly go into the macro and change the code for the range or search term you are needing. 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 rng Is Nothing Then '<-- I removed Not from the line. Try it now. xRow.Delete End If Next Application.ScreenUpdating = True End Sub |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
Alimou | Excel Programming | 4 | 02-06-2017 07:35 AM |
![]() |
beginner | Excel Programming | 5 | 12-26-2014 12:29 AM |
![]() |
Bathroth | Word VBA | 1 | 10-01-2014 01:40 PM |
![]() |
dozd | Excel | 1 | 02-22-2013 03:24 AM |
![]() |
elky1967 | Word VBA | 14 | 09-21-2012 05:27 AM |