|
では JmpCell2 を以下のコードと差し替え
Sub JmpCell3()
Dim Snm As String
If TypeName(Selection) <> "Range" Then Exit Sub
Snm = ActiveSheet.Name
With ActiveCell
Select Case .Column
Case 3, 8
If Snm = "Sheet1" Then
.Offset(, 1).Select
Else
.Offset(1).Select
End If
Case 5
If Snm = "Sheet2" Then
.Offset(, 2).Select
Else
.Offset(1).Select
End If
Case 4, 6
If Snm = "Sheet1" Or Snm = "Sheet2" Then
.Offset(, 2).Select
Else
.Offset(1).Select
End If
Case 11
If Snm = "Sheet1" Or Snm = "Sheet2" Then
.Offset(1, -8).Select
Else
.Offset(1).Select
End If
Case 22
If Snm = "Sheet2" Then
.Offset(1, -21).Select
Else
.Offset(1).Select
End If
Case 129
If .Row = 14 Then
If Snm = "Sheet1" Or Snm = "Sheet2" Then
.Offset(40, -3).Select
Else
.Offset(1).Select
End If
Else
.Offset(1).Select
End If
Case 126
Select Case .Row
Case 54, 56, 58, 60
If Snm = "Sheet1" Or Snm = "Sheet2" Then
.Offset(, 11).Select
Else
.Offset(1).Select
End If
Case Else: .Offset(1).Select
End Select
Case Else
.Offset(1).Select
End Select
End With
End Sub
ThisWorkbookモジュールの Workbook_SheetActivate と SheetDeactivate は
消して
Private Sub Workbook_Open()
With Application
.OnKey "{ENTER}", "JumpCell3"
.OnKey "~", "JumpCell3"
End With
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
With Application
.OnKey "{ENTER}"
.OnKey "~"
End With
ThisWorkbook.Save
End Sub
を入れ、いったんブックを閉じてから再度開いて、テストしてみて下さい。
|
|