[Range object variable]How to check the address in the Watch window (VBA)
In this article, we will show you how to check the address of a Range object variable in the Watch window.
If you’re struggling with something like this, give it a try.
- I’ve written many Debug.Print to find out the range of a Range object.
- I added a Range object to a watch expression, but I don’t know its address.
Check the address of the Range object variable in the Watch window
The Range object cannot check the address of a variable by adding it directly to a watch expression.
- What happens if we add it to the watch expression as is?
- How can I check the address?
The following is an explanation in the order of
You can add a Range object variable to a watch expression x
Sub rngAddress()
Dim rngSample As Range: Set rngSample = Range("A1:D4")
Dim int_i As Integer
End Sub

In the sample program above, suppose you added a Range object variable (rngSample) to the watch expression.

Although the watch window displays many properties of the Range object variable, you cannot see the address by looking in it. (There is no Address property.)
Range object variable with “.Address" to find out the address.
In order to check the address in the watch window, you need to be creative when adding a watch expression.

Add .address to the end of the variable name like this.

Then, the Address property of the Range object will be registered as a watch expression, and you can check the stunning address.
Special Thanks
- @dz11.
- @VBA07529852.
- @jbaske_032j
- @kyrtnyy
Thank you to everyone who provided information and helped verify the results on Twitter.
By the way, you can also display it by typing?rngObj.
This is also recommended if you just want to display it once or twice.
ディスカッション
コメント一覧
まだ、コメントがありません