ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Displaying the extent of a range variable (https://www.excelbanter.com/excel-programming/422225-displaying-extent-range-variable.html)

simonc

Displaying the extent of a range variable
 
What is the easy way of displaying the range of cells which is assigned to a
range variable? This is for debugging purposes, and I just want a property of
the variable which I can display with debug.print which will show me which
cells are in the range.

Grateful for advice.

Gary''s Student

Displaying the extent of a range variable
 
MsgBox (r.Parent.Name)
MsgBox (r.Address)

will display both the cells and the sheetname.
--
Gary''s Student - gsnu200825


"simonc" wrote:

What is the easy way of displaying the range of cells which is assigned to a
range variable? This is for debugging purposes, and I just want a property of
the variable which I can display with debug.print which will show me which
cells are in the range.

Grateful for advice.


simonc

Displaying the extent of a range variable
 
Gosh, thanks. I spent ages looking in the Locals list to find that. Who would
have thought it was so simple!

Gary''s Student

Displaying the extent of a range variable
 
You are very welcome.

By the way, in addition to displaying the sheetname and cells, you can use:

r.Parent.Parent.Name

to get the filename as well.
--
Gary''s Student - gsnu200825


"simonc" wrote:

Gosh, thanks. I spent ages looking in the Locals list to find that. Who would
have thought it was so simple!



All times are GMT +1. The time now is 05:23 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com