Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 43
Default SheetName Function

here is my function

Function SheetName(x) As String '
Application.Volatile
SheetName = ActiveSheet.name
End Function '

what i want to do is to get the sheet name in in which a cell (like
=SheetName(0)) is in.

not the. name of ActiveSheet.

what should i do.





  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default SheetName Function

Function SheetName(x) As String
Application.Volatile True
If x <= 0 Then
SheetName = "Worksheet number must be greater than 0"
Exit Function
End If
With Application.Caller.Parent.Parent
If x .Worksheets.Count Then
SheetName = "Warning: There is no worksheet"
Else
SheetName = .Worksheets(x).Name
End If
End With
End Function


--
Haldun Alay
"EXCEL$B!!(BNEWS" , haber iletisinde ?unlar? ...
here is my function

Function SheetName(x) As String '
Application.Volatile
SheetName = ActiveSheet.name
End Function '

what i want to do is to get the sheet name in in which a cell (like
=SheetName(0)) is in.

not the. name of ActiveSheet.

what should i do.





  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 42
Default SheetName Function

Hi
Not sure what you want - do you want to find the cell that contains the
sheet name ?


[C3] = activesheet.name will put the sheet name into any cell you
specify, lik C3. More info needed....

Andrew B




EXCEL$B!!(BNEWS wrote:
here is my function

Function SheetName(x) As String '
Application.Volatile
SheetName = ActiveSheet.name
End Function '

what i want to do is to get the sheet name in in which a cell (like
=SheetName(0)) is in.

not the. name of ActiveSheet.

what should i do.





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 718
Default SheetName Function

Maybe someting like this:

"------------------------------
Function sheetname(rng As Range) As String
sheetname = rng.Worksheet.Name
End Function
'------------------------------

HTH
--
AP

"EXCEL$B!!(BNEWS" a ecrit dans le message de
...
here is my function

Function SheetName(x) As String '
Application.Volatile
SheetName = ActiveSheet.name
End Function '

what i want to do is to get the sheet name in in which a cell (like
=SheetName(0)) is in.

not the. name of ActiveSheet.

what should i do.







  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 94
Default SheetName Function

I'm not sure what the variable "x" is for in your example.
But try this:

Function SHEETNAME() As String
Dim s As Object
Application.Volatile
Set s = Application.Caller
SHEETNAME = s.Parent.Name
End Function

You type in a cell:
=SHEETNAME()

The formula will return the sheetname of the sheet where you typed the
formula.

Regards,
Edwin Tam

http://www.vonixx.com


"EXCEL NEWS" wrote:

here is my function

Function SheetName(x) As String '
Application.Volatile
SheetName = ActiveSheet.name
End Function '

what i want to do is to get the sheet name in in which a cell (like
=SheetName(0)) is in.

not the. name of ActiveSheet.

what should i do.








  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 122
Default SheetName Function

Try this formula:

=MID(CELL("filename",A1),FIND("]",CELL("filename",A1))+1,256)

However, it will only work in sheets that have been saved, because
"filename" is an attribute that is set when the file is saved.

That came from:

http://www.ozgrid.com/VBA/return-sheet-name.htm

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default SheetName Function

thanks to all of you.
i have thought it out ,like Mr Edwin Tam suggested to me,
i will do better with his advice
thanks


"Edwin Tam" wrote in message
...
I'm not sure what the variable "x" is for in your example.
But try this:

Function SHEETNAME() As String
Dim s As Object
Application.Volatile
Set s = Application.Caller
SHEETNAME = s.Parent.Name
End Function

You type in a cell:
=SHEETNAME()

The formula will return the sheetname of the sheet where you typed the
formula.

Regards,
Edwin Tam

http://www.vonixx.com


"EXCEL NEWS" wrote:

here is my function

Function SheetName(x) As String '
Application.Volatile
SheetName = ActiveSheet.name
End Function '

what i want to do is to get the sheet name in in which a cell (like
=SheetName(0)) is in.

not the. name of ActiveSheet.

what should i do.







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
what's the function to return a sheetname in a cell in Excel? judi Excel Worksheet Functions 3 October 2nd 08 11:43 PM
Automatically update SheetName in workbook sub if SheetName changes [email protected] Excel Discussion (Misc queries) 3 February 29th 08 04:33 PM
Does anyone see this .xls]sheetname? Eric Excel Discussion (Misc queries) 2 January 21st 07 03:04 PM
Using a cell to reference sheetname in vlookup function jnasr Excel Worksheet Functions 1 October 25th 06 05:06 PM
SheetName J.E. McGimpsey Excel Programming 1 September 2nd 03 04:39 PM


All times are GMT +1. The time now is 10:21 AM.

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"