I am trying to use the Select Case function. I'm currently running into a run-time error "9". I know I am probably missing some basic VBA info, but I cant seem to identify what it is. here is my code
Code:
Sub HistoryPull()
With Worksheets("Data and Forecast-Prelim")
Select Case Range("I6")
Case Is = "42165"
Range("I6") = "INDEX('[Item Master Sales history.xlsx]Item Master Sales history'!$AX:$AX,MATCH($B:$B,'[Item Master Sales history.xlsx]Item Master Sales history'!$AU:$AU,0))"
Case Is = "42186"
Range("I6") = "INDEX('[Item Master Sales history.xlsx]Item Master Sales history'!$AS:$AS,MATCH($B:$B,'[Item Master Sales history.xlsx]Item Master Sales history'!$AP:$AP,0))"
Case Else
Range("I6") = "No Data"
End Select
End With
End Sub