Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Deleting Rows
What would be the proper code to remove all rows in a workbook except the
rows that counta = 11 or counta = 4. Thank you in advance |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Deleting Rows
Dim lastrow as Long, i as long
dim cnt as long lastrow = cells(rows.count,1).End(xlup).row for i = Lastrow to 1 step - 1 cnt = application.CountA(cells(i,1).EntireRow) if cnt < 11 and cnt < 4 then cells(i,1).Entirerow.Delete end if Next -- Regards, Tom Ogilvy "David Bateman" wrote in message ... What would be the proper code to remove all rows in a workbook except the rows that counta = 11 or counta = 4. Thank you in advance |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Deleting Rows
or I guess:
Dim LastRow As Long, i As Long LastRow = Cells(Rows.Count, 1).End(xlUp).Row For i = LastRow To 1 Step -1 Select Case Application.CountA(Rows(i)) Case 11, 4 Case Else: Rows(i).Delete End Select Next i Regards, KL "Tom Ogilvy" wrote in message ... Dim lastrow as Long, i as long dim cnt as long lastrow = cells(rows.count,1).End(xlup).row for i = Lastrow to 1 step - 1 cnt = application.CountA(cells(i,1).EntireRow) if cnt < 11 and cnt < 4 then cells(i,1).Entirerow.Delete end if Next -- Regards, Tom Ogilvy "David Bateman" wrote in message ... What would be the proper code to remove all rows in a workbook except the rows that counta = 11 or counta = 4. Thank you in advance |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro for deleting rows and serialising the remaing rows | Links and Linking in Excel | |||
Macro for deleting rows and serialising the remaing rows | Setting up and Configuration of Excel | |||
Macro for deleting rows and serialising the remaing rows | Excel Worksheet Functions | |||
Help!! I have problem deleting 2500 rows of filtered rows!!!! | Excel Discussion (Misc queries) | |||
deleting hidden rows so i can print only the rows showing?????? | Excel Worksheet Functions |