UDF showing full Path of Worksheet or Worksheet Name?

P

PDX

How can I modify Wallenbachs UDF to show the "Worksheet
Name" of the referenced worksheet and or the fullpath?

Function SHEETOFFSETNAME(offset, Ref)
' Returns cell contents at Ref, in sheet offset
Application.Volatile
With Application.Caller.Parent
SHEETOFFSETNAME = .Parent.Sheets(.Index +
offset).Range(Ref.Address).Value
End With
End Function

Thanks....
 
F

Frank Kabel

Hi
try something like (if Ref is the range)

ref.parent.name
for the worksheetname

and
ref.parent.parent.fullname
 
J

JE McGimpsey

One way to modify John WalKenbach's UDF:

Name:

SHEETOFFSETNAME = .Parent.Sheets(.Index + offset).Name

or


Full path and sheet name:

SHEETOFFSETNAME = .Parent.Fullname & "." & _
.Parent.Sheets(.Index + offset).Name
 

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