Use parameter name in InputBox function
Sub GetRange() Dim Rng As Range On Error Resume Next Set Rng = Application.InputBox(prompt:="Specify a range:", Type:=8) If Rng Is Nothing Then Exit Sub MsgBox "You selected range " & Rng.Address End Sub