AW: Datumseinträge ändern (plus/minus)
10.06.2012 00:02:34
CitizenX
Hi,
folgenden Code ins Modul der betreffenden Tabelle:
Option Explicit
Private Sub Worksheet_Deactivate()
With Application
.OnKey "{UP}"
.OnKey "{DOWN}"
End With
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
With Application
If Target(1).Address(0, 0) = "A1" Then
.OnKey "{UP}", "DateUP"
.OnKey "{DOWN}", "DateDWN"
Else
.OnKey "{UP}"
.OnKey "{DOWN}"
End If
End With
End Sub
und in ein allgemeines Modul:
Option Explicit
Sub DateUP()
Dim raC As Range: Set raC = ActiveCell
If raC.Address(0, 0) = "A1" And IsDate(raC) Then raC = raC + 1
End Sub
Sub DateDWN()
Dim raC As Range: Set raC = ActiveCell
If raC.Address(0, 0) = "A1" And IsDate(raC) Then raC = raC - 1
End Sub
Grüße
Steffen