Finding sheet a range is on?

D

Don Wiss

I was looking for a property that returned what sheet a range was on. I
didn't find it. So I wrote a simple function that plucked the sheetname
from the range.name. But is there a property that I didn't find?

Don <www.donwiss.com> (e-mail link at home page bottom).
 
G

Gary Keramidas

here are some examples

Sub name_ranges3() ' dumps all named ranges
Dim nm As Name

For Each nm In ThisWorkbook.Names
Debug.Print Range(nm).Parent.Name ' will give the sheet name of the
range
Debug.Print nm.Parent.Name ' will give the workbook name
Debug.Print nm.Name ' will give the range name
Next nm
End Sub
 

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

Top