Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
jim:
thanks for that tip, and the compliment. don't know how good it is, i just muddle my way through most of the time thanks again -- Gary "JMay" wrote in message news:J5yyf.138948$WH.98313@dukeread01... Another modification (to speed it up) would be to after each trip Up the column and if deletion takes place have the macro recalculate the "lastrow" integer. At present, it is agter each trip Up the column returning to Row 11 when in fact there is no data in row 11, 10, 9, 8 --- if 4 rows have already been deleted. I changed your reference to lastrow to BegLastRow and then put within the For Next statement a Recalculation statement and a new Reference NewLastRow to eliminate revisiting already deleted rows. Sub Foo() Dim arr As Variant Dim i As Long Dim BlastRow As Long Dim rng As Range Dim cell As Range Dim c As Long arr = Array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9") BegLastRow = Worksheets("Sheet1").Cells(Rows.Count, "A").End(xlUp).Row Set rng = Range("A1:A" & BegLastRow) For i = LBound(arr) To UBound(arr) Application.Calculate NewLastRow = Worksheets("Sheet1").Cells(Rows.Count, "A").End(xlUp).Row c = NewLastRow Do While c 0 If InStr(1, Range("a" & c), arr(i)) Then Rows(c).EntireRow.Delete Else End If c = c - 1 Loop Next End Sub Logically, this involves fewer passes. Gary Did an excellent job on this incidently; Thanks Gary... HTH, Jim May "Gary Keramidas" <GKeramidasATmsn.com wrote in message ... adding this would make it a little faster Application.ScreenUpdating = False code Application.ScreenUpdating = true -- Gary "brazen234" wrote in message ... -Yngve I ran your macro but it did not delete the rows with numbers. The list was the same after running it. -Gary Keramidas Thanks, your macro does work! But can it be faster ? My lists are in the tens of thousands. -Toppers Thanks but there are also occurences of the last character being alpha with numbers inbetween. -- brazen234 ------------------------------------------------------------------------ brazen234's Profile: http://www.excelforum.com/member.php...fo&userid=9952 View this thread: http://www.excelforum.com/showthread...hreadid=501478 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
MACRO HELP - deleting rows containing a range of blank cells | Excel Discussion (Misc queries) | |||
Need Help Creating a Macro to Multiply Cells by a Constant Number | Excel Discussion (Misc queries) | |||
Macro to add cells from unknown number of files | Excel Programming | |||
Deleting Hyphens or Dashes from multiple cells without deleting the remaining content | Excel Programming | |||
deleting variable number of rows | Excel Programming |