A "IF" result that will not result in a selected field when using

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

When using the IF function, is there a result, either "true" or "false that
will not trigger the END key to stop at that specific cell. For example, if
I use =IF(A1>B2, 2," "), and the statement is false, the cursor will stop on
that cell when using the END key because there is a space (" ") in that cell.
I have tried using =IF(A1>B2, 2,"") and =IF(A1>B2,2), but everything
produces a result that will stop the cursor on that cell when using the END
key.
 
The End key's function is not based on the value of a cell. It is based on
whether the cell is empty or not.
A cell with the formula below, produces an empty value. But the cell,
itself, is not empty and using End will stop on this cell if it is in the
path of the direction you are going.
=""

I don't know of a way to change that though standard excel keystrokes
without using some code.

You could use the code below and then set each macro to fuction with a
specific key combination (ex. - to move: right, Ctrl + R...Left, Ctrl +
L...Up, Ctrl + U...Down, Ctrl + D).


Sub endRight()

ActiveCell.End(xlToRight).Select
Do While ActiveCell.Value = ""
If ActiveCell.Column = 256 Then End
ActiveCell.End(xlToRight).Select
Loop

End Sub


Sub endLeft()

ActiveCell.End(xlToLeft).Select
Do While ActiveCell.Value = ""
If ActiveCell.Column = 1 Then End
ActiveCell.End(xlToLeft).Select
Loop

End Sub

Sub endUp()

ActiveCell.End(xlUp).Select
Do While ActiveCell.Value = ""
If ActiveCell.Row = 1 Then End
ActiveCell.End(xlUp).Select
Loop

End Sub
Sub endDown()

ActiveCell.End(xlDown).Select
Do While ActiveCell.Value = ""
If ActiveCell.Row = 65536 Then End
ActiveCell.End(xlDown).Select
Loop

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top