Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 12-06-2017, 05:17 AM
NoSparks NoSparks is offline Automatically delete row based on keyword-VBA Windows 7 64bit Automatically delete row based on keyword-VBA Office 2010 64bit
Excel Hobbyist
 
Join Date: Nov 2013
Location: British Columbia, Canada
Posts: 842
NoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of light
Default

perhaps something along the lines of this
Code:
Sub RemoveKeyWordRows()

Dim lr As Long, i As Long, cel As Range, temp As String

Application.ScreenUpdating = False
lr = Cells(Rows.Count, "A").End(xlUp).Row

For i = lr To 2 step -1
    temp = ""
        For Each cel In Range(Cells(i, "A"), Cells(i, "E"))
            temp = temp & cel.Value & " "
        Next cel
        
    '(keywords-loan,financial,bank,equity)
    If InStr(temp, "loan") > 0 Or _
       InStr(temp, "financial") > 0 Or _
       InStr(temp, "bank") > 0 Or _
       InStr(temp, "equity") > 0 _
       Then Rows(i).Delete
Next i
Application.ScreenUpdating = True

End Sub
Instr is case sensitive.

Last edited by NoSparks; 12-06-2017 at 09:55 AM. Reason: step
Reply With Quote
Reply

Tags
excel vba, macros



Similar Threads
Thread Thread Starter Forum Replies Last Post
Automatically delete row based on keyword-VBA How to delete automatically 500 “Heading 4” and all the contents in this from Navigation? liliaroma Word VBA 4 11-18-2017 07:53 PM
Automatically Delete Slides based on current time Pacman52 PowerPoint 2 07-16-2015 05:30 AM
How to Automatically Add/Delete Columns Based On Information kconnolly Excel 7 04-08-2014 07:23 AM
Find and Delete Rows based on a range damaniam Excel Programming 2 03-12-2014 06:06 AM
Automatically delete row based on keyword-VBA Find keyword in section & delete section donaldadams1951 Word VBA 5 12-03-2013 10:08 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 07:07 PM.


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