#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Sheet Name

I am trying to make a function that collects the name of a
sheet, and automatically fill in a cell on that sheet with
the name.

I'm trying something like:

Public Function Name() As String
On Error GoTo Skip
Back:
For x = 1 To 35
Name = Sheets(Sheet & x).Name
Next x
Skip:
x = x + 1
GoTo Back
End Function

Any help would be appreciated.

Thanks,
John
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Sheet Name

I assume this will be used in a worksheet

Public Function MyName()
Application.Volatile
MyName = Application.Caller.Parent.Name
End Function

It will only update when a calculation is performed.
--
Regards,
Tom Ogilvy

John Viall wrote in message
...
I am trying to make a function that collects the name of a
sheet, and automatically fill in a cell on that sheet with
the name.

I'm trying something like:

Public Function Name() As String
On Error GoTo Skip
Back:
For x = 1 To 35
Name = Sheets(Sheet & x).Name
Next x
Skip:
x = x + 1
GoTo Back
End Function

Any help would be appreciated.

Thanks,
John



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,080
Default Sheet Name

Hi John:

Try:

Public Function SheetName() As String
SheetName = Application.Caller.Parent.Name
End Function

Regards,

Vasant.

"John Viall" wrote in message
...
I am trying to make a function that collects the name of a
sheet, and automatically fill in a cell on that sheet with
the name.

I'm trying something like:

Public Function Name() As String
On Error GoTo Skip
Back:
For x = 1 To 35
Name = Sheets(Sheet & x).Name
Next x
Skip:
x = x + 1
GoTo Back
End Function

Any help would be appreciated.

Thanks,
John



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
excel sheet bootom half sheet goes behind top part of sheet rob Excel Worksheet Functions 2 January 17th 09 01:28 AM
Duplicate sheet, autonumber sheet, record data on another sheet des-sa[_2_] Excel Worksheet Functions 0 May 8th 08 06:56 PM
"='sheet 1'!D4" auto fill sheet to sheet ='sheet 2'!D4 mistewalker Excel Worksheet Functions 5 January 6th 08 11:36 PM
How do I select price from sheet.b where sheet.a part no = sheet.b Sonny Excel Worksheet Functions 4 April 4th 06 05:08 PM
relative sheet references ala sheet(-1)!B11 so I can copy a sheet. RonMc5 Excel Discussion (Misc queries) 9 February 3rd 05 12:51 AM


All times are GMT +1. The time now is 12:51 AM.

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

About Us

"It's about Microsoft Excel"