View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson[_3_] Dave Peterson[_3_] is offline
external usenet poster
 
Posts: 2,824
Default Worksheet Data Filters

Stolen from a previous post:

Option Explicit
Sub testme()

Dim myRngF As Range

Set myRngF = Nothing
On Error Resume Next
With ActiveSheet.AutoFilter.Range
Set myRngF = .Offset(1, 0).Resize(.Rows.Count - 1, 1) _
.Cells.SpecialCells(xlCellTypeVisible)
End With
On Error GoTo 0

If myRngF Is Nothing Then
MsgBox "No cell to select"
Else
myRngF.Areas(1).Cells(1, 1).Select
End If

End Sub



"D.S." wrote:

I'm writing some code to set worksheet filters, and would like to have my
active cell in the first visible row after the filters have been set.
Sometimes the active cell is in a row that has been filtered out, therefore
it's not visible.

Any ideas how to code this so that the active cell would be in the first
visible row? or any visible row?

--
D.S.


--

Dave Peterson