Home |
Search |
Today's Posts |
#10
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
If all rows are visible then that would be the expected/desired behavior -
all rows met the critiera (or you could check that there is actually criteria applied). In the case of no rows meeting the criteria (only the header row visible), that has bitten me several times and I usually put in code to test for that. In the mixed case, that is the desired behavior. -- Regards, Tom Ogilvy "keepITcool" wrote in message t.com... Tom, Done some more testing... If autofilter is active the delete method will delete: specified rows if ALL those rows are either visible or hidden, but if the specified range contains a mix of hidden and visible rows, then only the visible rows will be deleted. Sub test() Fill [3:9].Delete [a1].AutoFilter MsgBox "Deleted 3:9" _ & vbLf & "Mixed visibility = Visible rows 4,6,8 deleted" Fill [3:3,5:5,7:7,9:9].Delete [a1].AutoFilter MsgBox "Deleted 3,5,7,9" _ & vbLf & "All rows hidden = specified rows deleted" Fill [3:3,5:5,7:7,9:10].Delete [a1].AutoFilter MsgBox "Deleted 3,5,7,9:10" _ & vbLf & "Mixed = only the visible row(10) in spec deleted" End Sub Sub Fill() Cells.Clear [a1:b1] = Array("Number", "Even") [a2:a11] = [ROW(2:11)] [b2:b11] = [INDEX(MOD(ROW(2:11),2)=0,0,1)] [a1].AutoFilter [a1].AutoFilter 2, True End Sub -- keepITcool | www.XLsupport.com | keepITcool chello nl | amsterdam Tom Ogilvy wrote : ActiveSheet.AutoFilter.Range.EntireRow.Delete Activesheet.Range(Activesheet.Autofilter.Range.Add ress).EntireRow.Dele te For me (and as I would expect) Both worked the same in Excel 2002 Only the visible rows (including the header row) were deleted. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
rogue rows appear in autofiltered sort | Excel Discussion (Misc queries) | |||
Macro for deleting rows and serialising the remaing rows | Setting up and Configuration of Excel | |||
Copy Autofiltered rows to another workbook using macro | Excel Discussion (Misc queries) | |||
How to plot only visible autofiltered rows in a data list | Charts and Charting in Excel | |||
Count Autofiltered Rows? | Excel Programming |