Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 64
Default Sheet Naming


I got 2 ways from this forum a while back ....hope it helps


Option 1:

Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, _
ByVal Target As Range)

on error resume next
sh.Name = sh.Range("a2").Value
if err.number < 0 then
msgbox "Rename failed"
err.clear
end if
on error goto 0
End Sub


Option 2:

Option Explicit
Private Sub Workbook_SheetCalculate(ByVal Sh As Object)

Application.EnableEvents = False
On Error Resume Next
Sh.Name = Sh.Range("a2").Value
If Err.Number < 0 Then
MsgBox "Rename failed"
Err.Clear
End If
On Error GoTo 0
Application.EnableEvents = True

End Sub

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)

If Intersect(Target, Sh.Range("a2")) Is Nothing Then
Exit Sub
End If

On Error Resume Next
Sh.Name = Sh.Range("a2").Value
If Err.Number < 0 Then
MsgBox "Rename failed"
Err.Clear
End If
On Error GoTo 0

End Sub

Cheers,
Mayte
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Naming a sheet Mike Excel Discussion (Misc queries) 3 March 7th 07 08:43 AM
naming sheet tab artist4christ Excel Worksheet Functions 5 January 17th 07 11:54 PM
Naming Sheet mehare Excel Discussion (Misc queries) 4 August 14th 06 06:20 PM
Sheet naming Pat Excel Programming 7 December 15th 04 10:29 PM
Naming a new sheet. Rich Cooper Excel Programming 1 May 25th 04 09:56 PM


All times are GMT +1. The time now is 01:16 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"