Hello
Im trying to add 30 days into the put date but it could not work. anyone to advice me?
below is the syntax
Private Sub Worksheet_Change(ByVal Target As Range)
Dim lastrow As Long
lastrow = Cells(Rows.Count, "b").End(xlUp).Row
For i = 20 To lastrow
If Range("b" & i).Value <> "" Then
Range("c3") = Now()
Range("C3").NumberFormat = "dd/mm/yyyy hh:mm:ss AM/PM"
ElseIf Range("b" & i).Value = "" Then
Range("c3") = Now()
Range("C3").NumberFormat = "dd/mm/yyyy hh:mm:ss AM/PM"
End If
Next i
For i = 20 To lastrow
If Range("v" & i).Value <> "" Then
Range("w" & i).Value = Range("v" & i).Value * Range("g" & i).Value
Range("w" & i).NumberFormat = "$#,##0.00"
End If
Next i
For i = 20 To lastrow
If Range("r" & i).Value <> "" Then
Range("s" & i).Value = Range("r" & i).Text + 30
Range("s" & i).NumberFormat = "dd/mm/yyyy"
End If
Next i
End Sub
Im trying to add 30 days into the put date but it could not work. anyone to advice me?
below is the syntax
Private Sub Worksheet_Change(ByVal Target As Range)
Dim lastrow As Long
lastrow = Cells(Rows.Count, "b").End(xlUp).Row
For i = 20 To lastrow
If Range("b" & i).Value <> "" Then
Range("c3") = Now()
Range("C3").NumberFormat = "dd/mm/yyyy hh:mm:ss AM/PM"
ElseIf Range("b" & i).Value = "" Then
Range("c3") = Now()
Range("C3").NumberFormat = "dd/mm/yyyy hh:mm:ss AM/PM"
End If
Next i
For i = 20 To lastrow
If Range("v" & i).Value <> "" Then
Range("w" & i).Value = Range("v" & i).Value * Range("g" & i).Value
Range("w" & i).NumberFormat = "$#,##0.00"
End If
Next i
For i = 20 To lastrow
If Range("r" & i).Value <> "" Then
Range("s" & i).Value = Range("r" & i).Text + 30
Range("s" & i).NumberFormat = "dd/mm/yyyy"
End If
Next i
End Sub