thank you guys for the suggestions Ill try them both; I'm a bit slow tho so Ill get back to you as soon as possible.
here is the full code (just to avoid confusions on what im trying to do)
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Row = 1 Then Exit Sub
On Error GoTo ErrHandler
Application.EnableEvents = False
If Target.Column = 5 Then
Target.Select
Target.Value = WorksheetFunction.Trim(Target)
Selection.Find(What:=" ", After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False).Activate
Selection.Replace What:=" ", Replacement:="/", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
End If
If Target.Column = 13 Or Target.Column = 15 Or Target.Column = 17 Then
If Target.Value = "Approved" Or Target.Value = "Declined" Then
'ActiveSheet.Unprotect Password:="test"
Target.Offset(0, 1).Value = "=NOW()"
Target.Offset(0, 1).Activate
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Target.Offset(1, 0).Activate
Else
Target.Offset(0, 1).Clear
End If
'ActiveSheet.Protect Password:="test"
End If
If Target.Column = 8 Then
If Target.Value = "A" Or Target.Value = "M" Or Target.Value = "V" Then
Target.Offset(0, 1).Value = "=NOW()"
Target.Offset(0, 1).Activate
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Target.Offset(1, 0).Activate
Else
Target.Offset(0, 1).Clear
End If
End If
ErrHandler:
Application.EnableEvents = True
End Sub
I was working on it and made a slight change; putting both codes together here is the part Im working on right now
If Target.Column = 5 Then
Target.Select
Target.Value = WorksheetFunction.Trim(Target)
Selection.Find(What:=" ", After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False).Activate
Selection.Replace What:=" ", Replacement:="/", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
End If
it seems like is working now however when I pull the data and paste it I get this green pointer "the cell contains a date string represented with only 2 digits for the year." when I click on "convert XX to 20XX" the macro runs perfectly...I tried to record it but it doesn't shown anything; i can use it like it is but just because I'm learning I would like to know if this can be corrected.
thanks again! Ill try your codes
Bookmarks