Hi all,
I have a worksheet that has a drop down list in cell d17 and when I change only that cell I want to run a block of code, otherwise just skip over that block. Here is my code:
Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
If Range("i5") = 1 Then
Range("i6") = 0.32
Else: Range("i6") = 0.18
End If
If Target.Address = "$d$17" Then
x = 100
If Range("i3") = 1 Then
Range("d18") = x
Else
ifstatement:
x = InputBox("Estimated % Saturation: ")
End If
If x > 100 Or x < 0 Then
MsgBox ("Error: enter a value between 0 and 100.")
GoTo ifstatement
Else
Range("d18") = x
End If
End If
Application.EnableEvents = True
End Sub
For some reason, it doesn't run anything when I select the other option. I don't know if this makes a difference, but the drop down list contains words and not numbers.
Also, I have cell i3 set to be a 1 or 0 depending on the selection, so that is why you see that in the code.
Thanks in advance for all the help,
Chris
Bookmarks