Displaying the extent of a range variable

  • Thread starter Thread starter simonc
  • Start date Start date
S

simonc

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.
 
MsgBox (r.Parent.Name)
MsgBox (r.Address)

will display both the cells and the sheetname.
 
Gosh, thanks. I spent ages looking in the Locals list to find that. Who would
have thought it was so simple!
 
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top