I have been using this bit of code to get a user selected column (uses worksheet and string inputs). HOwever, if the user selects cancel, it errors out. Interestingly, it was working until I declared all my variable types. Any idea how to work around the error?
Private Function getCol(sh As Worksheet, s As String) As Integer Dim x Dim y Dim checkS As String Dim a() As Variant Dim rng As rng sh.Activate Set rng = Application.InputBox("Select the COLUMN containing the " & s, s, , , , , , 8) getCol = rng.Column End Function