ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Selection after filtering (https://www.excelbanter.com/excel-programming/275438-selection-after-filtering.html)

PEdro

Selection after filtering
 
Hi,

I have a database that filtered
Now I want to select the next row after the 4th. Given that I have filter
the next row is the 777
What code should I write in order to select the row that is show by the
filter has the next to the 4th , taking into account that this can be change
if the filter change

Regards
PM



Tom Ogilvy

Selection after filtering
 
set rng = Activesheet.autofilter.Range.Columns(1)
set rng = rng.offset(1,0).Resize(rng.rows.count-1)
set rng = rng.specialcells(xlVisible)
set rng1 = nothing
i = 0
for each cell in rng
i = i + 1
if i = 5 then
set rng1 = cell
exit sub
end if
Next
rng1.Select

--
Regards,
Tom Ogilvy


"Pedro" wrote in message
...
Hi,

I have a database that filtered
Now I want to select the next row after the 4th. Given that I have filter
the next row is the 777
What code should I write in order to select the row that is show by the
filter has the next to the 4th , taking into account that this can be

change
if the filter change

Regards
PM





Tom Ogilvy

Selection after filtering
 
Sub SelectFirstVisible()
Dim rng As Range
Set rng = ActiveSheet.AutoFilter.Range.Columns(1)
Set rng = rng.Offset(1, 0).Resize(rng.Rows.Count - 1)
On Error Resume Next
Set rng = rng.SpecialCells(xlVisible)
On Error GoTo 0
If Not rng Is Nothing Then
rng(1).Select
Else
MsgBox "No rows visible"
End If
End Sub

--
Regards,
Tom Ogilvy


"Pedro" wrote in message
...
Thanks Tom

Can you please explain what those steps do?
I attached a copy of the spreadsheet database I filtered it by the A
column(selecting 0009718) and by the C column (selecting Equities)
How can I select the 774 row (the one that is visible next to the 1st

row)?

Regards
Pedro


"Tom Ogilvy" wrote in message
...
set rng = Activesheet.autofilter.Range.Columns(1)
set rng = rng.offset(1,0).Resize(rng.rows.count-1)
set rng = rng.specialcells(xlVisible)
set rng1 = nothing
i = 0
for each cell in rng
i = i + 1
if i = 5 then
set rng1 = cell
exit sub
end if
Next
rng1.Select

--
Regards,
Tom Ogilvy


"Pedro" wrote in message
...
Hi,

I have a database that filtered
Now I want to select the next row after the 4th. Given that I have

filter
the next row is the 777
What code should I write in order to select the row that is show by

the
filter has the next to the 4th , taking into account that this can be

change
if the filter change

Regards
PM











All times are GMT +1. The time now is 06:58 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com