I have top 8 rows frozen. When I'm in row 8 in K:S and if I press Enter key, I'd like a cell in column A to be selected in whatever row happened to be scrolled to the top.
Example: row 500 may be scrolled up and be immediately under top 8 frozen rows. If I press Enter key, while in Range("k8:s8"), code should select A500. If top row is 600, then A600 should be selected.
Code I have only selects specific, hard coded cell. And with that, not only when I press Enter while in Range("k8:s8"), but anywhere on the sheet.
Example: row 500 may be scrolled up and be immediately under top 8 frozen rows. If I press Enter key, while in Range("k8:s8"), code should select A500. If top row is 600, then A600 should be selected.
Code I have only selects specific, hard coded cell. And with that, not only when I press Enter while in Range("k8:s8"), but anywhere on the sheet.
VBA Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Intersect(Target, Range("k8:s8")) Is Nothing Then
Application.OnKey "~", "OnEnterK8S8"
End If
End Sub
Sub OnEnterK8S8()
ActiveSheet.Range("A629").Select
End Sub