将下面的代码放入标准模块

Sub GetRange()

Dim Rng As Range

On Error Resume Next

Set Rng = Application.InputBox(prompt:="Enter range",Type:=8)

If Rng Is Nothing Then

MsgBox "Operation Cancelled"

Else

Rng.Select

End If

End Sub