Well I ended up with a routine which only runs the highlight when I use the cursor keys. It consists of this in the worksheet module:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Application.OnKey "{RIGHT}", "HighlightRight"
Application.OnKey "{LEFT}", "HighlightLeft"
Application.OnKey "{UP}", "HighlightUp"
Application.OnKey "{DOWN}", "HighlightDown"
End Sub
And this in module 1:
Sub HighlightRight()
On Error Resume Next
x = ActiveCell.Column
y = ActiveCell.Row
Range("a" & y, "az" & y).Select
Range(Cells(ActiveCell.Row, x + 1), Cells(ActiveCell.Row, x + 1)).Activate
End Sub
Sub HighlightLeft()
On Error Resume Next
x = ActiveCell.Column
y = ActiveCell.Row
Range("a" & y, "az" & y).Select
Range(Cells(ActiveCell.Row, x - 1), Cells(ActiveCell.Row, x - 1)).Activate
End Sub
Sub HighlightUp()
On Error Resume Next
x = ActiveCell.Column
y = ActiveCell.Row
Range("a" & y - 1, "az" & y - 1).Select
Range(Cells(y - 1, x), Cells(y - 1, x)).Activate
End Sub
Sub HighlightDown()
On Error Resume Next
x = ActiveCell.Column
y = ActiveCell.Row
Range("a" & y + 1, "az" & y + 1).Select
Range(Cells(y + 1, x), Cells(y + 1, x)).Activate
End Sub
Problem:
I do not want the routine to run when I switch to another sheet.
-Aldo
This message was edited by on 2003-01-23 19:53