Tab names in cells

You can get the tab names in cells using the CELL function. If you prefer to use a user-defined function, you can try something simple, like this function:

Function TabName1() As String
Application.Volatile
TabName1 = ActiveSheet.Name
End Function

This function won’t provide the desired outcome, however, because it always returns the name of the active worksheet. That means that if you have the function called on each of the sheets in your workbook, it will always return the name of the active sheet on each of those worksheets, instead of the name of the sheet on which the function is used. The following function provides better results:

Function TabName2() As String
Application.Volatile
TabName2 = Application.Caller.Parent.Name
End Function

If you think you’ll want to use the function to refer to a worksheet name elsewhere in the workbook, then this function will work better for you:

Function TabName3(cell As Range)
TabName3 = cell.Worksheet.Name
End Function
This version of the function requires that you provide a cell reference—any cell reference—to a cell on the worksheet whose name you want to use.

Of course, if you would rather not use a user-defined function, you could simply create a macro that would stuff the name of each worksheet tab into the same cell in each worksheet. For instance, the following macro steps through each of the worksheets in the workbook and places the name of each worksheet into cell A1.

Sub TabName4()
For J = 1 To ActiveWorkbook.Sheets.Count
Sheets(J).Cells(1, 1).Value = Sheets(J).Name
Next
End Sub

You should note that this approach is not dynamic (it needs to be rerun each time you change worksheet names or add new worksheets). It also overwrites anything that is in cell A1. (If you want the worksheet names placed in a different cell on each worksheet, change the values used in the Cells collection.)

Creating Custom Lists

AutoFill can be a timesaver if you often work with common lists of data. You can define your own custom lists and then use them over and over again, as described here.

A great timesaver when entering data is to use Excel’s AutoFill feature. To use the feature, enter enough cells that Excel can figure out how you want to fill the remaining cells in series. For instance, enter 1 and 2 into two cells, or 5 and 10 into two others, or Monday and Tuesday. Select the two cells and then click and drag the Fill handle at the bottom-right corner of the selection border.
As cool as AutoFill is, an even cooler timesaving feature is to define your own series of values that AutoFill can use. Follow these steps:

  1. Click the Office button and then click Excel Options. Excel displays the Excel Options dialog box.
    Make sure Popular is selected at the left of the dialog box.
  2. Click Edit Custom Lists. Excel displays the Custom Lists dialog box and hides the Excel Options dialog box.
  3. Select NEW LIST in the Custom Lists list.
  4. In the List Entries portion of the dialog box, start typing the items in your fill series, in the order they should appear. For instance, you might type a list of department managers in alphabetic order. Press Enter at the end of each element.
  5. When you are done, click the Add button.
  6. Click OK to close the Custom Lists dialog box. The Excel Options dialog box reappears.
  7. Click OK to close the Excel Options dialog box.

You can now use the custom list for the AutoFill feature. Simply type whatever entry from the custom list you want to start with, select the cell, and then drag the Fill handle. Excel fills the selected cells with the items from your custom list, in order.