Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 471
Default Down One Row

Usually I can navigate a spreadsheet by getting the row # and going down 1 row:
x=activecell.row
x=x+1
cells(x,1).select
So if I was on row 25 now I am on row 26. But what if the data is filtered
and row 26 is not in the filter. I want to go down 1 row but how can I know
which row that is?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 698
Default Down One Row

Try something like this:

Sub DownToNextVisibleCell()
Dim lngCtr As Long
Dim lngCurrCol As Long

lngCurrCol = ActiveCell.Column

For lngCtr = ActiveCell.Row + 1 To Rows.Count
With Cells(RowIndex:=lngCtr, ColumnIndex:=lngCurrCol)
If .EntireRow.Hidden = False Then
.Select
Exit For
End If
End With
Next lngCtr
End Sub


Is that something you can work with?
***********
Regards,
Ron

XL2003, WinXP


"Mike H." wrote:

Usually I can navigate a spreadsheet by getting the row # and going down 1 row:
x=activecell.row
x=x+1
cells(x,1).select
So if I was on row 25 now I am on row 26. But what if the data is filtered
and row 26 is not in the filter. I want to go down 1 row but how can I know
which row that is?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 471
Default Down One Row

That works perfectly. Thanks a lot.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Down One Row

What do you mean by how can you know? You won't see it in Excel, because you
have selected a non-visible row, but it is still active, and

?activecell.Row


returns that row in the immediate window.

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Mike H." wrote in message
...
Usually I can navigate a spreadsheet by getting the row # and going down 1
row:
x=activecell.row
x=x+1
cells(x,1).select
So if I was on row 25 now I am on row 26. But what if the data is
filtered
and row 26 is not in the filter. I want to go down 1 row but how can I
know
which row that is?



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 698
Default Down One Row

I'm glad I could help, Mike........Thanks for the feedback.

***********
Regards,
Ron

XL2003, WinXP


"Mike H." wrote:

That works perfectly. Thanks a lot.

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



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