ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Using Arrow keys in a macro (https://www.excelbanter.com/excel-programming/360742-using-arrow-keys-macro.html)

Kevryl

Using Arrow keys in a macro
 
I need to use an arrow key in a macro to move to the next row down. The
"offset" command is of no use because I have filtered the rows by this stage
and it lands the cursor in a filtered out row, rather than the next visible
row down. I suspect that if I can find out how to use the "End(x1down)"
without the "End" it will operate only across the visible rows, because
"End(x1down)" does .

Does anyone know the answer to the problem?


Mike Fogleman

Using Arrow keys in a macro
 
How about a quick macro to select the next visible cell below the
activecell?

Sub NextFilterCell()
Dim i As Long

i = 1
For i = 1 To 655536
If Not ActiveCell.Offset(i, 0).EntireRow.Hidden Then
ActiveCell.Offset(i, 0).Select
Exit Sub
Else
i = i + 1
End If
Next i
End Sub


Mike F
"Kevryl" wrote in message
...
I need to use an arrow key in a macro to move to the next row down. The
"offset" command is of no use because I have filtered the rows by this
stage
and it lands the cursor in a filtered out row, rather than the next
visible
row down. I suspect that if I can find out how to use the "End(x1down)"
without the "End" it will operate only across the visible rows, because
"End(x1down)" does .

Does anyone know the answer to the problem?




Kevryl

Using Arrow keys in a macro
 
Thanks Mike, that works fine! I knew there must be a way.
Regards,
Keith

"Mike Fogleman" wrote:

How about a quick macro to select the next visible cell below the
activecell?

Sub NextFilterCell()
Dim i As Long

i = 1
For i = 1 To 655536
If Not ActiveCell.Offset(i, 0).EntireRow.Hidden Then
ActiveCell.Offset(i, 0).Select
Exit Sub
Else
i = i + 1
End If
Next i
End Sub


Mike F
"Kevryl" wrote in message
...
I need to use an arrow key in a macro to move to the next row down. The
"offset" command is of no use because I have filtered the rows by this
stage
and it lands the cursor in a filtered out row, rather than the next
visible
row down. I suspect that if I can find out how to use the "End(x1down)"
without the "End" it will operate only across the visible rows, because
"End(x1down)" does .

Does anyone know the answer to the problem?





Dana DeLouis

Using Arrow keys in a macro
 
Just another option to select the next visible cell down:

Range(ActiveCell(2), Cells(65536, ActiveCell.Column)). _
SpecialCells(12).Areas(1).Cells(1).Select

--
HTH. :)
Dana DeLouis
Windows XP, Office 2003


"Kevryl" wrote in message
...
Thanks Mike, that works fine! I knew there must be a way.
Regards,
Keith

"Mike Fogleman" wrote:

How about a quick macro to select the next visible cell below the
activecell?

Sub NextFilterCell()
Dim i As Long

i = 1
For i = 1 To 655536
If Not ActiveCell.Offset(i, 0).EntireRow.Hidden Then
ActiveCell.Offset(i, 0).Select
Exit Sub
Else
i = i + 1
End If
Next i
End Sub


Mike F
"Kevryl" wrote in message
...
I need to use an arrow key in a macro to move to the next row down. The
"offset" command is of no use because I have filtered the rows by this
stage
and it lands the cursor in a filtered out row, rather than the next
visible
row down. I suspect that if I can find out how to use the "End(x1down)"
without the "End" it will operate only across the visible rows, because
"End(x1down)" does .

Does anyone know the answer to the problem?








All times are GMT +1. The time now is 01:25 PM.

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