Hi,
I have the following code that should recognise a value change on a range of cells and then run a simple piece of code to add in a formula etc. However on the range I have given the cells have data validation applied but the user can also free type whatever they want in the cell. What I am struggling with is this code works when the data validation is used to change the cell value but does not work if I type in to the cell!!!
I need it to work if either the data validation drop-down is used or a user types in to a cell in the range given.
Thanks for any assistance in advance.
Steven
I have the following code that should recognise a value change on a range of cells and then run a simple piece of code to add in a formula etc. However on the range I have given the cells have data validation applied but the user can also free type whatever they want in the cell. What I am struggling with is this code works when the data validation is used to change the cell value but does not work if I type in to the cell!!!
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Me.Range("$M$5:$M$65536")) Is Nothing Then
Else
Application.ScreenUpdating = False
Application.EnableEvents = False 'to prevent endless loop
ActiveCell.Offset(0, 1).Select
ActiveCell.FormulaR1C1 = _
"=IF(RC[-1]="""","""",IF(LEFT(RC[-1],4)=""WG10"",""Internal"",""External""))"
ActiveCell.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
ActiveCell.Offset(0, -1).Select
End If
Application.EnableEvents = True
Application.ScreenUpdating = True
End Sub
I need it to work if either the data validation drop-down is used or a user types in to a cell in the range given.
Thanks for any assistance in advance.
Steven