
‘Module1
Option Explicit
Sub A_Sample003()
Dim myRng As Range
Dim myStr As String
myStr = “マウスでセル範囲を選択して、OKボタンを押してください”
On Error Resume Next
Set myRng = Application.InputBox(myStr, Type:=8)
On Error GoTo 0
If myRng Is Nothing Then
MsgBox “キャンセルされました”
Else
MsgBox myRng.Address
End If
Set myRng = Nothing ‘オブジェクトの解放
End Sub
