Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 60
Default Worksheet Data Filters

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   Report Post  
Posted to microsoft.public.excel.programming
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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 60
Default Worksheet Data Filters

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
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
Two windows of the same worksheet , but want filters on one Pat Adams Excel Discussion (Misc queries) 2 April 29th 08 04:09 PM
Protecting a worksheet with filters Toshiba Excel Worksheet Functions 2 May 8th 06 06:28 PM
Worksheet protection vs filters Paul Excel Discussion (Misc queries) 2 April 13th 05 04:07 PM
How can I protect an excel worksheet containing filters? JMcG Excel Discussion (Misc queries) 4 April 13th 05 03:13 PM
Is it possible to use filters in a protected worksheet? jpici Excel Discussion (Misc queries) 1 March 10th 05 08:39 PM


All times are GMT +1. The time now is 12:10 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"