I am checking a cell and if it is true then copy that row toanother spreadsheet, then I insert a date to another column which all worksgreat. What I would like to do now is check to see if there is already a datein that column, if blank then add it
This is the code that works:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count > 1 Then Exit Sub
If Not Intersect(Target, Columns(12)) Is Nothing Then
IfUCase(Target.Value) = "R" Then
Range("A" & Target.Row).Resize(1, 45).CopySheets("Precalc").Cells(Rows.Count, 1).End(xlUp)(2)
Target.EntireRow.Delete
Sheets("Precalc").Cells(Rows.Count, 12).End(xlUp).Offset(, 1)= Date
End If
End If
End Sub
I don’t know how to program the address to check the date(might be easier to change the date before copying to another sheet?)
If UCase(Target.Value) = "R" Then
Range("A" & Target.Row).Resize(1, 45).CopySheets("Precalc").Cells(Rows.Count, 1).End(xlUp)(2)
Target.EntireRow.Delete
If Target.Row,column 13 <> blank then
Sheets("Precalc").Cells(Rows.Count, 12).End(xlUp).Offset(, 1)= Date
End If
End If
Thanks
This is the code that works:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count > 1 Then Exit Sub
If Not Intersect(Target, Columns(12)) Is Nothing Then
IfUCase(Target.Value) = "R" Then
Range("A" & Target.Row).Resize(1, 45).CopySheets("Precalc").Cells(Rows.Count, 1).End(xlUp)(2)
Target.EntireRow.Delete
Sheets("Precalc").Cells(Rows.Count, 12).End(xlUp).Offset(, 1)= Date
End If
End If
End Sub
I don’t know how to program the address to check the date(might be easier to change the date before copying to another sheet?)
If UCase(Target.Value) = "R" Then
Range("A" & Target.Row).Resize(1, 45).CopySheets("Precalc").Cells(Rows.Count, 1).End(xlUp)(2)
Target.EntireRow.Delete
If Target.Row,column 13 <> blank then
Sheets("Precalc").Cells(Rows.Count, 12).End(xlUp).Offset(, 1)= Date
End If
End If
Thanks