Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
That seems to work, thanks a lot.
"Dave Peterson" wrote in message ... 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Two windows of the same worksheet , but want filters on one | Excel Discussion (Misc queries) | |||
Protecting a worksheet with filters | Excel Worksheet Functions | |||
Worksheet protection vs filters | Excel Discussion (Misc queries) | |||
How can I protect an excel worksheet containing filters? | Excel Discussion (Misc queries) | |||
Is it possible to use filters in a protected worksheet? | Excel Discussion (Misc queries) |