You don't say anything about how you determine whether a cell value has changed or if it matters what it has been changed to and from. Do you compare with another value?
If it doesn't matter, try to place this code in the sheet (not in a module):
Option Explicit
Dim o As Integer
Private Sub Worksheet_Change(ByVal Target As Range)
Dim s As String
If ActiveCell.Column = 6 Then
Cells(o, 5).Select
s = Int(Right(ActiveCell.Value, 4)) + 5
Cells(o, 5).Value = "P2_" & s
End If
End Sub
' Don't place this code in the _Change event
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
o = ActiveCell.Row
End Sub
Let me know if you can't use this!
|