xxthegiantxx
New Member
- Joined
- Jan 5, 2017
- Messages
- 24
I have an input box set up to prompt the user to select a range of cells. When i select cancel and no data range was selected, i get a run-time error '13: type mismatch. Clicking on debug it refers me to my set calculated_range line of code. Not sure what i am doing wrong. The code works perfectly when a range is selected.
Also, if you have link to a video or website that you would recommend for learning vba i would appreciate it.
Here's my code:
Also, if you have link to a video or website that you would recommend for learning vba i would appreciate it.
Here's my code:
Code:
Sub Button3_Click()
Dim Calculated_Range
Set Calculated_Range = Application.InputBox("Calculate Weekly Hours", "Select a Range from Column 'F'", "Enter Range", , , , , 8)
If Calculated_Range = "" Then
MsgBox "No Range Selected"
GoTo ending
Else
MsgBox "Range Selected: " & Calculated_Range.Address
End If
Range("R3").Formula = "=Sum(" & Calculated_Range.Address & ")"
ending:
End Sub
Last edited by a moderator: