Forum Discussion
Kneshalewiseeocgov
Jan 10, 2023Copper Contributor
excel dates
Hi, I hope someone can help. I am working on spreadsheet with a column that will have received dates for cases as they come in and I want to add a column that will add 30 days to that date automatica...
OliverScheurich
Jan 10, 2023Gold Contributor
Maybe with these lines of code. You can enter a date in any cell in range A2:A25 and the date + 30 days is added in the adjacent cell.
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rngBereich As Range
Set rngBereich = Range("A2:A25")
If Not Application.Intersect(Target, rngBereich) Is Nothing Then
If IsDate(Target.Value) Then
Target.Offset(0, 1).Value = Target.Value + 30
Else
End If
End If
End Sub