If the ActiveCell is on Row 1, you can't go up (the Offset function would
generate an error if you tried)... the If test makes sure the code doesn't
try. By the way, it might not be clear from Ed's posting, but you don't need
that test for the OneDown macro, but you should test to make sure you aren't
at the bottom of the worksheet...
Sub OneDown()
If ActiveCell.Row < ActiveSheet.Rows.Count Then
ActiveCell.Offset(1, 0).Select
End If
End Sub
--
Rick (MVP - Excel)
"Grindy" wrote in message
...
Thanks for the quick response Ed. A related question...
What is the purpose of the "If/Then" part of your code, ie.
If ActiveCell.Row 1 Then
Just trying to learn why it is needed.
Thanks again,
bob
"Ed Ferrero" wrote:
Hi Grindy,
To go up one cell...
Sub OneUp()
If ActiveCell.Row 1 Then
ActiveCell.Offset(-1, 0).Select
End If
End Sub
Going down use...
ActiveCell.Offset(1, 0).Select
Ed Ferrero
www.edferrero.com