I have this code below, it works well with the exception if "cancel" is clicked on the input box. It is selecting all of the shapes on the page and changes the color of them from yellow to brown. So basically it is running the rest of the code after cancel is clicked.
Thanks
What I would like is if cancel is clicked to exit sub
Thanks
What I would like is if cancel is clicked to exit sub
Code:
Sub RACKCHART_Group26_Click()
Dim myITEM As String, myRng As Range, NewLoc As String
Dim Found As Range, RackSht As Worksheet
Application.ScreenUpdating = False
Set RackSht = Sheets("Rack Chart")
'Search for Product Code or Lot Number
myITEM = InputBox("Enter what you would like to search for.", "Search", "Enter Here")
Sheets("List").Select
Set Found = Columns("C:D").Find(what:=myITEM, LookIn:=xlValues, lookat:=xlWhole)
If Found Is Nothing Then
MsgBox ("Item " & myITEM & " could not be found.")
RackSht.Select
Exit Sub
Else
Application.ScreenUpdating = True
End If
Application.ScreenUpdating = False
Range("F" & Found.Row).Select
NewLoc = ActiveCell.Value
Sheets("Rack Chart").Select
Application.ScreenUpdating = True
ActiveSheet.Shapes(NewLoc).Select
'Turn Selection YELLOW
With Selection.ShapeRange.Fill
.Visible = msoTrue
.ForeColor.RGB = RGB(255, 255, 0)
.Transparency = 0
.Solid
End With
MsgBox ("The location of your item is " & NewLoc)
'Turn Selection back to BROWN
With Selection.ShapeRange.Fill
.Visible = msoTrue
.ForeColor.RGB = RGB(153, 102, 51)
.Transparency = 0
.Solid
End With
Range("a1").Select
End Sub