Hi, James,
usually you could use the Worksheet_Change-event for that but I think you already have used that event for monitoring other cells so you would need to integrate the code there as well.
On itīs own the code may look like (please notice that there may only be one event of each name behind each single sheet):
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count = 1 Then
With Target
If .Column = 5 And .Row > 5 Then
If .Value = "Return" Then
If .Offset(0, 4).Value <> vbNullString Or .Offset(0, 5).Value <> vbNullString Then
If MsgBox("This action will erase data in the 'Item Exchange' and 'Exchange Unit' cells", vbOKCancel) = vbOK Then
Application.EnableEvents = False
.Offset(0, 4).Value = vbNullString
.Offset(0, 5).Value = vbNullString
Application.EnableEvents = True
Else
Application.EnableEvents = False
Application.Undo
Application.EnableEvents = True
End If
End If
End If
End If
End With
End If
End Sub
Your exisiting procedure must be rewritten in order to accept this case as well.
Ciao,
Holger
Bookmarks