Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 -- Gary''s Student |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Gary,
Try r.Parent.Parent.Name --- Regards, Norman "Gary''s Student" wrote in message ... 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 -- Gary''s Student |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thank you both very much.
-- Gary''s Student "Norman Jones" wrote: Hi Gary, Try r.Parent.Parent.Name --- Regards, Norman "Gary''s Student" wrote in message ... 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 -- Gary''s Student |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Object property/method problem | Excel Discussion (Misc queries) | |||
438 - Object doesn't support this property or method | Excel Programming | |||
Object doesn't support this property or method | Excel Programming | |||
Object not supporting property or method | Excel Programming | |||
Object doesn't support this property or method | Excel Programming |