Thread: Worksheet Names
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Worksheet Names

Since it's based on a formula, then maybe using _calculate would be a better
event to use:

Option Explicit
Private Sub Worksheet_Calculate()
On Error Resume Next
Me.Name = Me.Range("a1").Value
If Err.Number < 0 Then
Beep
MsgBox "Invalid name in A1!"
Err.Clear
End If
On Error GoTo 0
End Sub





Mike H wrote:

Hi,

Right click the sheet tab, view code and paste this in

Private Sub Worksheet_Change(ByVal Target As Range)
On Error Resume Next
ActiveSheet.Name = Range("A1").Value
End Sub

Mike

"veggies27" wrote:

Is it possible to name worksheets based on a formula?

I want sheet1 to be renamed to be whatever is in sheet1!A1 for instance.


--

Dave Peterson