Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Max Max is offline
external usenet poster
 
Posts: 9,221
Default Grab all filtered rows for some action

In an autofiltered range, I currently select all the filtered rows for
deletion manually. Is there a way to automate this manual selection of
filtered rows bit once I select any cell within the filtered rows? Thanks


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,073
Default Grab all filtered rows for some action

On May 8, 7:59 am, "Max" wrote:
In an autofiltered range, I currently select all the filtered rows for
deletion manually. Is there a way to automate this manual selection of
filtered rows bit once I select any cell within the filtered rows? Thanks


After selecting the whole lot go Edit|Goto|Special|Visible cells only|
OK

Ken Johnson
  #3   Report Post  
Posted to microsoft.public.excel.programming
Max Max is offline
external usenet poster
 
Posts: 9,221
Default Grab all filtered rows for some action

After selecting the whole lot go Edit|Goto|Special|Visible cells only|
OK


When I tried the above (eg: recorded macro below), it unfortunately also
grabs the header row in the selection. The header row should not be
selected, only the filtered rows. How can the header row be deselected?

Sub Macro1()
Range("B3:F17").Select
Selection.AutoFilter
Selection.AutoFilter Field:=1, Criteria1:="33"
Selection.SpecialCells(xlCellTypeVisible).Select
Selection.EntireRow.Delete
End Sub


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Grab all filtered rows for some action

Option Explicit
Sub testme()

Dim VRng As Range

Set VRng = Nothing
On Error Resume Next
With ActiveSheet.AutoFilter.Range
'avoid the header row???
Set VRng = .Resize(.Rows.Count - 1, 1).Offset(1, 0) _
.Cells.SpecialCells(xlCellTypeVisible)
End With
On Error GoTo 0

If VRng Is Nothing Then
MsgBox "no visible details"
Else
'do something with the visible rows
msgbox vrng.address(0,0)
End If

End Sub

Max wrote:

In an autofiltered range, I currently select all the filtered rows for
deletion manually. Is there a way to automate this manual selection of
filtered rows bit once I select any cell within the filtered rows? Thanks


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.programming
Max Max is offline
external usenet poster
 
Posts: 9,221
Default Grab all filtered rows for some action

That works fine. Thanks, Dave.




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Performing Action on a Range of Rows JohnB[_2_] Excel Discussion (Misc queries) 1 July 20th 07 01:48 AM
Cut filtered rows, paste into next empty row of new sheet, and delete cut rows Scott Excel Worksheet Functions 0 December 13th 06 01:25 AM
2 sheets 2 rows grab 1 karatehero Excel Worksheet Functions 2 November 10th 06 05:05 PM
Take Action Based Upon # of Rows in Another Worksheet Paige Excel Programming 3 August 21st 06 11:49 PM
Filtered Visible Rows & VBA Non-Filtered Rows Displayed QTE[_15_] Excel Programming 8 July 11th 04 02:21 AM


All times are GMT +1. The time now is 10:35 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"