This works for me -
Sub casestatements()
Dim filmname As String, filmlength As Integer, filmtype As String
filmname = Application.InputBox("Select the film", Type:=0)
filmlength = ActiveCell.Offset(0, 1).Value
Select Case filmlength
Case 1, 2, 3, 4
filmtype = "short"
Case 5, 6, 7, 8
filmtype = "medium"
Case Else
filmtype = "Long"
End Select
MsgBox filmname & " is " & filmtype
End Sub
I hard coded values in the filmlength variable while testing though..
And is this a Typo? 7 filmtype
Besides, I am not convinced Application.InputBox is the way to go.. And ActiveCell.Offset will always refer to the value to the corresponding column of the activecell, irrespective of what filmname you type, as you have referred to 1 Column Offset of the Activecell.. Which according to me is causing the problem.
Bookmarks