View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Andy Pope Andy Pope is offline
external usenet poster
 
Posts: 2,489
Default Workbook Property or Method

Hi,

You can make use of the Parent property. The example show it's use on
both the .Worksheet and Range object.

Function whereisit(r As Range) As String
MsgBox (r.Address)
MsgBox (r.Worksheet.Name)
MsgBox (r.Worksheet.Parent.Name)
whereisit = r.Address & r.Worksheet.Name & r.Parent.Parent.Name
End Function

Cheers
Andy

Gary''s Student wrote:
How do I get the Workbook name associated with a range?

Function whereisit(r As Range) As String
MsgBox (r.Address)
MsgBox (r.Worksheet.Name)
whereisit = r.Address & r.Worksheet.Name
End Function

I need the workbook name as well as the Address and worksheet name.

Thanks in advance


--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info