MightyQuinn
Board Regular
- Joined
- Dec 28, 2007
- Messages
- 152
I have this code (which works perfectly), now I want to add in an If statement to it (in red below).
It should check to see IF a cell = "text" then it runs a macro, ELSEIF cell = "other text" it runs another macro and ELSE will do nothing.
Here is my code:
Note: Only need to add the code in red. And I have the simple macros working already.
It should check to see IF a cell = "text" then it runs a macro, ELSEIF cell = "other text" it runs another macro and ELSE will do nothing.
Here is my code:
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("W39")) Is Nothing Then
On Error GoTo Error:
Select Case Target.Value
Case "10 x 10"
Application.EnableEvents = False
Macro4
[COLOR="Red"]IF AH15 = "IM130 Rev A"
Macro5
Elseif AH15= "IM100 Rev B"
Macro6
Else will do nothing[/COLOR]
GoTo Finish
Case "10 x 7.5"
Application.EnableEvents = False
Macro1
GoTo Finish
Case "10 x 5"
Application.EnableEvents = False
Macro2
GoTo Finish
Case "10 x 2.5"
Application.EnableEvents = False
Macro3
GoTo Finish
Case Else
MsgBox "Unexpected value, please select again."
Application.EnableEvents = False
GoTo Finish:
End Select
End If
Finish:
Application.EnableEvents = True
Exit Sub
Error:
MsgBox "Macro not found!"
End Sub
Note: Only need to add the code in red. And I have the simple macros working already.