Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Below is a piece of code I use to delete rows that contain a specific keyword
in a designated column. Right now I specify the range m2:m1500, but rarely have that many lines in the raw data. I chose the number 1500 to be sure the code runs on all lines. Right now this is the largest time contributor to the macro I run on the data, of which this is a small part. Is there an approach I can follow other than the one shown below that addresses the speed, and would also not require me to specify the range... so it acts only the actual number of row of data in the worksheet? Thanks, Scott '---------------------------------------------------- 'Delete extra lines '---------------------------------------------------- myWords = Array("2") Set wks = ActiveSheet With wks With .Range("m2:m1500") For iCtr = LBound(myWords) To UBound(myWords) Do Set FoundCell = .Cells.Find(What:=myWords(iCtr), _ after:=.Cells(.Cells.Count), _ LookIn:=xlValues, _ LookAt:=xlPart, _ SearchOrder:=xlByRows, _ searchdirection:=xlNext, _ MatchCase:=False) If FoundCell Is Nothing Then Exit Do Else FoundCell.EntireRow.Delete End If Loop Next iCtr End With End With |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Formula/Approach Question | Excel Worksheet Functions | |||
What is the right approach? | Excel Worksheet Functions | |||
How to approach this? | Excel Discussion (Misc queries) | |||
New approach | Excel Programming | |||
How do I approach this? | Excel Programming |