
Use a user-defined function to copy the name
of a worksheet into a cell
To copy the name of a worksheet into a cell, you have to create a
user-defined function.
4
To copy the name of a worksheet into a cell:
1. Press <Alt+F11> to open the Visual Basic Editor.
2. From the Insert menu, click Module.
3. Type the following function:
Function TabName()
TabName = ActiveSheet.Name
End Function
4. Close the VBA Editor by pressing <Alt+Q>, and in cell
A1 type the following function: =TabName().
5. Press <Enter>.
322
Chapter 13
Figure 13-1
Figure 13-2