Incrementing Months and Years
Nov09
As you know, I love keyboard shortcuts. But I hate entering dates. So I created this little helper. In my new accounting system, they also have shortcut keys for incrementing weeks, months, and years. I don’t have much use for incrementing weeks, but I could kick myself for not thinking of the others. Plus Alt+semi-colon is just sitting there doing nothing.
Public Sub IncrementMonth()
On Error Resume Next
gclsAppEvents.AddLog "%;", "IncrementMonth"
If IsDate(ActiveCell.Value) Then
ActiveCell.Value = DateSerial(Year(ActiveCell.Value), Month(ActiveCell.Value) + 1, Day(ActiveCell.Value))
ElseIf IsTextTime(ActiveCell.Text) Then
ActiveCell.Value = ActiveCell.Value + 1 / 24
End If
End Sub
Public Sub DecrementMonth()
On Error Resume Next
gclsAppEvents.AddLog "+%;", "DecrementMonth"
If IsDate(ActiveCell.Value) Then
ActiveCell.Value = DateSerial(Year(ActiveCell.Value), Month(ActiveCell.Value) - 1, Day(ActiveCell.Value))
ElseIf IsTextTime(ActiveCell.Text) Then
ActiveCell.Value = ActiveCell.Value - 1 / 24
End If
End Sub
Public Sub IncrementYear()
On Error Resume Next
gclsAppEvents.AddLog "^%;", "IncrementYear"
If IsDate(ActiveCell.Value) Then
ActiveCell.Value = DateSerial(Year(ActiveCell.Value) + 1, Month(ActiveCell.Value), Day(ActiveCell.Value))
ElseIf IsTextTime(ActiveCell.Text) Then
ActiveCell.Value = ActiveCell.Value + 1
End If
End Sub
Public Sub DecrementYear()
On Error Resume Next
gclsAppEvents.AddLog "^+%;", "DecrementYear"
If IsDate(ActiveCell.Value) Then
ActiveCell.Value = DateSerial(Year(ActiveCell.Value) - 1, Month(ActiveCell.Value), Day(ActiveCell.Value))
ElseIf IsTextTime(ActiveCell.Text) Then
ActiveCell.Value = ActiveCell.Value - 1
End If
End Sub




