msussams
02-07-2021, 11:10 AM
What Am I doing wrong
what I want to input in code is this:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 2 And Target.Value <> "" Then
Application.EnableEvents = False
Target.Offset(0, -1) = Format(Now(), "MM-DD-yyyy")
Target.Offset(0, 6).Value = "TO"
Target.Offset(0, 7).Value = "TEFA"
Target.Offset(0, 1).Value = "GWR"
Target.Offset(0, 8).formula = "=IF(I156="","",IF(I156="TEFA",IF(O156="D/D","Disputed","Unallocated"),VLOOKUP(I156,Bugle!A:C,3)))"
Application.EnableEvents = True
End If
End Sub
But it doesn't like it when I add this line - it comes up with an error.
Target.Offset(0, 8).formula = "=IF(I156="","",IF(I156="TEFA",IF(O156="D/D","Disputed","Unallocated"),VLOOKUP(I156,Bugle!A:C,3)))"
It works ok without itbefore i input it but doesn't work with it or after I have to recopy and paste from an old version to get it to do it without the formula
What is it
what I want to input in code is this:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 2 And Target.Value <> "" Then
Application.EnableEvents = False
Target.Offset(0, -1) = Format(Now(), "MM-DD-yyyy")
Target.Offset(0, 6).Value = "TO"
Target.Offset(0, 7).Value = "TEFA"
Target.Offset(0, 1).Value = "GWR"
Target.Offset(0, 8).formula = "=IF(I156="","",IF(I156="TEFA",IF(O156="D/D","Disputed","Unallocated"),VLOOKUP(I156,Bugle!A:C,3)))"
Application.EnableEvents = True
End If
End Sub
But it doesn't like it when I add this line - it comes up with an error.
Target.Offset(0, 8).formula = "=IF(I156="","",IF(I156="TEFA",IF(O156="D/D","Disputed","Unallocated"),VLOOKUP(I156,Bugle!A:C,3)))"
It works ok without itbefore i input it but doesn't work with it or after I have to recopy and paste from an old version to get it to do it without the formula
What is it