View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default Extracting Sheet Name

Nick,

You can use a VBA function like the following:

Function GetSheetName(R As Range) As String
GetSheetName = R.Worksheet.Name
End Function

Then, call it from a worksheet cell with
=GetSheetName(Sheet3!A1)


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Nick H" wrote in message
...
I'd like to create a worksheet function that will take as input

a cell
reference or range, and will return the name of the worksheet

that the input
cell/range is on. For example, I would like to be able to

enter a function
with this general name/form:

=Sheetname('Sheet1'!A1)

and get the following text:

Sheet1

Thanks for any help!

Nick