Date issue

Kutrenia

New Member
Joined
Dec 31, 2009
Messages
17
:confused:

Help please!

In Column A - if I input a date (other than today), then make my selection in Column F, the date that I had input in Column A does not hold. Example:
  • Today is 5/4
  • I put 5/3 in Column A.
  • I select "Brookhaven" in Column F
  • The date in Column A changes to 5/4
  • I can go back and change Column A back to 5/3, but is there a way to make it stay 5/3 without going back?
Current code looks like this:
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Me.Range("F6:F49"), Target) Is Nothing Then
If Target = "" Then
Target.Offset(, -5).Value = ""
Target.Offset(, 2) = ""
ElseIf Target = " " Then
Target.Offset(, -5).Value = ""
Target.Offset(, 2) = ""
Else

Target.Offset(, -5).Value = Now
Target.Offset(, 2).Value2 = Now + 14
End If
End If
End Sub


 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
This line:

Code:
Target.Offset(, -5).Value = Now

is putting today's date in column A when a cell in column F changes.
 
Upvote 0
Yes, and I want it to enter today's date if no other date is present. But if there is a date there, I want that date to stay and only update the Followup date which is equal to the Target.Offset(,-5) date + 14 days.
 
Upvote 0
Thank you! With a little bit of tweaking it works perfectly!
The final code I came up with is shown below:

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Me.Range("F6:F49"), Target) Is Nothing Then
With Target.Offset(, -5)
If .Value = "" Then
.Value = Now
Target.Offset(, 2) = Now + 14
Else
Target.Offset(, 2) = Target.Offset(, -5).Value + 14
End If
End With
End If
End Sub :p
 
Upvote 0

Forum statistics

Threads
1,216,079
Messages
6,128,687
Members
449,464
Latest member
againofsoul

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top