View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jim Thomlinson Jim Thomlinson is offline
external usenet poster
 
Posts: 5,939
Default Inserting a worksheet tab name into a cell

In a standard code module (the same kind you get when you record a macro) you
can add the following function.

Public Function TabName() As String
Application.Volatile
TabName = Application.Caller.Worksheet.Name
End Function

This function can be used in a cell in a spreadsheet. For example on the
Lynn Bales sheet in the cells of column D add =TabName()

If the name of the sheet changes then this formula will automatically update
the next the the sheet is calculated.
--
HTH...

Jim Thomlinson


"Lynn Bales" wrote:

I have a workbook with several worksheet tabs that have individual names on
them. I need to take the name and put it going down a column inside the
worksheet of that name for varying number of rows and I need to do this for
each worksheet.

Example:

Workbook A has sheets named
Lynn Bales, Joe Brown, Daphne Anderson

In worksheet Lynn Bales, I want the text "Lynn Bales" to go into column D to
the end of the rowed data. Then I want to do the same for Joe Brown's
worksheet and Daphne Anderson's worksheet.

Is this feasible? Thank you in advance!

Lynn