LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
D D is offline
external usenet poster
 
Posts: 121
Default naming tab macro error runtime error 1004

Gary DK very kindly provided a solution for naming tabs from the contents of
a cell on a worksheet. A further problem has arisen:

The contents of cell B7 on all 125 sheets provides the name for the sheet
tab. Cell B7 gets its information from a separate master sheet.

When I sort the master sheet (because new entries have been added at the
bottom and need to be arranged according to a ref. code) I get an error
message: Runtime error 1004 Cannot rename a sheet to the same name as another
sheet, a referenced object library or a workbook referenced by Visual Basic.

this is the code:

Option Explicit
Private shname As String

Private Sub Worksheet_Calculate()
If Range("B7").Value < shname Then
shname = [b7].Value
End If
Me.Name = shname
End Sub


Any ideas?


 
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
Macro Runtime Error 1004... help? Derrick Excel Discussion (Misc queries) 6 June 24th 09 03:04 PM
Macro runtime 1004 error on opening worksheet Shaggyjh Excel Discussion (Misc queries) 5 May 6th 09 12:37 PM
unable to protect cells in macro sheet b/c runtime error 1004 rldjda Excel Worksheet Functions 1 March 20th 08 08:28 PM
Macro runtime error 1004 with Autofilter Lorna B Excel Discussion (Misc queries) 3 May 25th 07 08:38 PM
Excel 2003 Macro Error - Runtime error 1004 Cow Excel Discussion (Misc queries) 2 June 7th 05 01:40 PM


All times are GMT +1. The time now is 03:44 AM.

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

About Us

"It's about Microsoft Excel"