View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.newusers
Robert McCurdy Robert McCurdy is offline
external usenet poster
 
Posts: 102
Default Rename tab on cell event

In the sheet code module, paste this in - change [A2] to your desired cell.


Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, [A2]) Is Nothing _
Or [A2] = "" Then Exit Sub
Dim wks As Worksheet
For Each wks In Sheets
If UCase([A2]) = UCase(wks.Name) Then
MsgBox "Can't rename a sheet with " & [A2].Value _
& vbNewLine & "as that name already exist."
Exit Sub
End If
Next wks
On Error Resume Next
ActiveSheet.Name = [A2].Value2
If Err.Number < 0 Then MsgBox Err.Description
End Sub

Well it was going to be a 1 liner, but that's been taken :)


Regards
Robert McCurdy
"John G." wrote in message ...
Looking for code that would simply, on the fly, depending what was entered in
a cell at anytime, any amount of times, the tab name would be renamed to what
the cell contents are.

I have seen some pretty elaborate ways of renaming tabs. I am new at Excel
and any help would be appreciated. Thanks!