Can a sheet be named automatically based off the value of a cell?
Yes
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Not Intersect(Target, Range("A1")) Is Nothing Then
Me.Name = Range("A1").Value
End If
End Sub
This is event code. Right-click on the sheet tab and "View Code".
Copy/paste the code into that sheet module.
Note: this code will not be triggered by a calculated vale in A1, just an
entered value.
If you want the name change based on a calculated value use this instead.
Private Sub Worksheet_Calculate()
Me.Name = Range("A1").Value
End Sub
No error checking in either set of code.
Gord Dibben MS Excel MVP
On Wed, 16 May 2007 07:39:00 -0700, ktun wrote:
|