View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jan Karel Pieterse Jan Karel Pieterse is offline
external usenet poster
 
Posts: 535
Default How do I pass a worksheets name to function?

Hi Phillips,

I would like to make a function that I can pass the name of a work sheet to
it, so I can use the function for many different uses.


You could use the Parent property of a range object:

Function Test(MyRange as Range)
Msgbox " Called from sheet '" & MyRange.Parent.Name &"'."
End Function

Then just use
=Test(Sheet1!A1)
in a cell.

Regards,

Jan Karel Pieterse
Excel MVP
www.jkp-ads.com