Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Workbook Property or Method

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   Report Post  
Posted to microsoft.public.excel.programming
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
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Workbook Property or Method

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Workbook Property or Method

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Object property/method problem Ayo Excel Discussion (Misc queries) 6 August 30th 07 10:18 PM
438 - Object doesn't support this property or method Revtim Excel Programming 0 September 12th 05 09:09 PM
Object doesn't support this property or method davegb Excel Programming 11 May 12th 05 03:36 PM
Object not supporting property or method Stuart[_5_] Excel Programming 3 August 23rd 03 07:45 AM
Object doesn't support this property or method Rick Campbell Excel Programming 2 July 13th 03 11:53 PM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"