Daily tips for using Microsoft Excel.

Wednesday, May 22, 2002

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:

WORKBOOK MODULE

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