Change the Worksheet Tabname to Reflect the Value in a Cell


May 22, 2002 - by Juan Pablo Gonzalez

Ed asks:

I wish to match the name of a worksheet tab with the header of a form automatically. In other words, If I type the name of the form in a header (a cell), the worksheet tab would somehow be linked (or ref) to the header, and would change the name to match the header name.

This requires some code in the Worksheet module (Or in the workbook module, to work for all sheets). Try the following:

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
	If Target.Address = "$A$1" Then Sh.Name = Target
End Sub