Hello, i have some existing code which is trigerred when anything is input into column c. The code then adds various information in another three columns. One of which pastes a vlookup formulae, and i would like this forumlae pasted into the column c cell which i initialy edited, in order to remove the requirement for one additional column.
The existing code i have is:
I have tried changing the offset to (0,0) or changing the offset to 'target = ', which does add in the vlookup but then the macro debugs at the 'If .Value <> "" Then' code?
Any suggestions are appreciated
Thanks
Matt
The existing code i have is:
Code:
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Dim MyText As String
MyText = Environ("username")
If Target.Cells.Column = 3 Then
With Target
If .Value <> "" Then
.Offset(0, 2).Formula = "=VLOOKUP(D:D,'P:\TAOffshore\TAOffshoreTreasuryRecs\General\Commit ID''s for control Sheet - Do not move or delete\[commit ids - DO NOT DELETE OR MOVE.xls]Sheet1'!$A$1:$B$65536,2,0)"
.Offset(0, 3).Value = Format(Now, "MM/DD/YYYY")
.Offset(0, 1).Value = MyText
End If
End With
End If
End Sub
I have tried changing the offset to (0,0) or changing the offset to 'target = ', which does add in the vlookup but then the macro debugs at the 'If .Value <> "" Then' code?
Any suggestions are appreciated
Thanks
Matt