Excel UDF Get Worksheet name

In Excel there is no built in function to check and return a result for the worksheets name. Even though it may be in clear sight to a user at the bottom of the sheet on it’s tab, there may be situations where the worksheets name is required to be referenced against, such as counting the number of times the worksheets name appears in a range for example.

This straightforward UDF must be copied and pasted into a VBA Module for it to become a ‘standard’ formula in your current workbook.

To use it, simply choose any cell and type the formula:

=SheetName(A1)

This function doesn’t actually refer to anything in cell A1, you can put any cell reference in here, but it requires at least a cell reference to allow it to work.

Feel free to send us a question or leave a comment below and we’ll answer your query in the open !

Function SheetName(rAnyCell)
Application.Volatile
SheetName = rAnyCell.Parent.Name
End Function
<\code>


Contact us for some advice and guidance on how your Excel development could be created and start helping your business straight away. Contact Us

Datanology

Leave a Reply

Your email address will not be published. Required fields are marked *