Date Entered +7, unless another field is greater than 0

C

chickalina

I have a column H which is the date a work orderis entered into the
spreadsheet. This date is automatically entered with TODAY() as soon as
something is typed in the Work Order number column. I would like the Due Date
column to automatically fill in with a week from the date entered (as a
static date, because rushes can happen).

This is the code I'm using for TODAY...
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Target, Columns("A:A")) Is Nothing Then
On Error GoTo endit
Application.EnableEvents = False
If IsNumeric(Target) Then
Target.Offset(0, 8).Value = Format(Date, "mm/dd/yyyy")
End If
End If
endit:
Application.EnableEvents = True
End Sub

Could I just add to this? and how? Or does it need separate code? and what
would that be?

Thanks for any help!
 
P

Per Jessen

Hi

We use the current event code. You don't tell where to place due date, so I
place it next to the order date.

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Target, Columns("A:A")) Is Nothing Then
'On Error GoTo endit
Application.EnableEvents = False
If IsNumeric(Target) Then
Target.Offset(0, 8).Value = Format(Date, "mm/dd/yyyy")
DueDate = Date + Day(7)
Target.Offset(0, 9).Value = DueDate
End If
End If
endit:
Application.EnableEvents = True
End Sub

Regards,
Per
 
C

chickalina

Thanks so much.... works like a dream!

Per Jessen said:
Hi

We use the current event code. You don't tell where to place due date, so I
place it next to the order date.

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Target, Columns("A:A")) Is Nothing Then
'On Error GoTo endit
Application.EnableEvents = False
If IsNumeric(Target) Then
Target.Offset(0, 8).Value = Format(Date, "mm/dd/yyyy")
DueDate = Date + Day(7)
Target.Offset(0, 9).Value = DueDate
End If
End If
endit:
Application.EnableEvents = True
End Sub

Regards,
Per
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top