Private Sub CommandButton2_Click()
Dim Lab As String, location, cell As String, res
With Sheets("Search")
Lab = [E4]: location = [F4]
res = Application.Index(Range("Location_Tbl"), Application.Match(location, Range("Locations"), 0), Application.Match(Lab, Range("Labs"), 0))
If IsError(res) Then
MsgBox "Location " & location & " not valid for lab " & Lab, vbExclamation
Exit Sub
Else
cell = res
If cell = "" Then
MsgBox "Location " & location & " not valid for lab " & Lab, vbExclamation
Exit Sub
End If
End If
End With
With Sheets(Lab)
.Activate
.Range(cell).Select
End With
End Sub
Bookmarks