See code below
I have this code that whenever a user picks MISC from a drop down validation in the A column it prompts them for a reason for choosing it which then pastes that reason to the subsequent E column. However when I click cancel it just puts FALSE in the E column and leaves the MISC. I tried using this...
to delete the A column if they hit cancel but it isn't working. I dont want the user to be able to cancel out and leave the MISC box there. I want to basically force them to enter a reason. Thanks in advance!
Code:
Private Sub Worksheet_Change(ByVal TARGET As Range)
Dim sReason As String
If TARGET.Cells.Count > 1 Then Exit Sub
Application.ScreenUpdating = False
If Not Intersect(TARGET, Range("A1:A500")) Is Nothing Then
If TARGET.Value = "MISC" Then
sReason = Application.InputBox("Reason for MISC?", Type:=2)
TARGET.Offset(0, 4) = sReason
End If
End If
For I = 1 To 2000
If Range("A" & I) = "MISC" And Range("E" & I) = "FALSE" Then
Range("A" & I & ":E" & I).ClearContents
End If
Next I
Application.ScreenUpdating = True
End Sub
I have this code that whenever a user picks MISC from a drop down validation in the A column it prompts them for a reason for choosing it which then pastes that reason to the subsequent E column. However when I click cancel it just puts FALSE in the E column and leaves the MISC. I tried using this...
Code:
For I = 1 To 2000
If Range("A" & I) = "MISC" And Range("E" & I) = "FALSE" Then
Range("A" & I & ":E" & I).ClearContents
End If
Next I
to delete the A column if they hit cancel but it isn't working. I dont want the user to be able to cancel out and leave the MISC box there. I want to basically force them to enter a reason. Thanks in advance!