AW: Von Zelle zu Zelle springen mittels "TAB"
25.07.2017 13:54:28
Rudi
Hallo,
in ein allg. Modul:
Public Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
Im Klassenmodul der Tabelle:
Dim rngOld As Range
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim x, strTab As String
Dim vArr, vPos
strTab = "AB3-F9-AB9-G11-J15-J17-AD15-AD17-J22-J24-J26-I40-R40-I47-R47-I50-R50-I53-R53-I62- _
R62-I69-R69-I76-I83-I90-R90-I97-R97-AB3"
vArr = Split(strTab, "-")
If vArr(0) vArr(UBound(vArr)) Then
'damit der Kreislauf funktioniert
ReDim Preserve vArr(0 To UBound(vArr) + 1)
vArr(UBound(vArr)) = vArr(0)
End If
x = GetAsyncKeyState(&H9)
If CBool(x And &H8000) Then
If Not rngOld Is Nothing Then
vPos = Application.Match(rngOld.Address(0, 0), vArr, 0)
If Not IsError(vPos) Then
Application.EnableEvents = False
Range(vArr(vPos)).Select
Application.EnableEvents = True
End If
End If
End If
Set rngOld = ActiveCell
End Sub
Gruß
Rudi