Hello,
I am looking for a macro to search specific column (Lets Say Column B), search for a word "Demo" within data at every cell in that column and delete all those rows consist of it
Is it possible?
Thanks
Hello,
I am looking for a macro to search specific column (Lets Say Column B), search for a word "Demo" within data at every cell in that column and delete all those rows consist of it
Is it possible?
Thanks
This would do as you've described. It is not CASE specific so it will find DEMO, demo, DEmo, and any other variation. It also only deletes once at the end, so should be quicker than a row by row deletion.
![]()
Sub DeleteDEMOrows() Dim delRNG As Range, vFIND As Range, vFIRST As Range On Error Resume Next Set vFIND = Range("B:B").Find(What:="demo", LookAt:=xlPart, MatchCase:=False, SearchFormat:=False) On Error GoTo 0 If Not vFIND Is Nothing Then Set vFIRST = vFIND Set delRNG = vFIND Do Set delRNG = Union(delRNG, vFIND) Set vFIND = Cells.FindNext(After:=vFIND) Loop Until vFIND.Address = vFIRST.Address delRNG.EntireRow.Delete xlShiftUp End If End Sub
_________________
Microsoft MVP 2010 - Excel
Visit: Jerry Beaucaire's Excel Files & Macros
If you've been given good help, use theicon below to give reputation feedback, it is appreciated.
Always put your code between code tags. [CODE] your code here [/CODE]
?None of us is as good as all of us? - Ray Kroc
?Actually, I *am* a rocket scientist.? - JB (little ones count!)
Thank you very much
If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks