Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.misc
Big Rick
 
Posts: n/a
Default Tabname Changes

Hello Folks
I have a workbook with 53 worksheets. the first 52 sheets have the tab name
as the week-ending date. The 53rd sheet is called Info and contains the
following code. (I am very grateful to Dave Peterson for providing me with
this code.)

Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "C4"

Dim iCtr As Long
Dim wks As Worksheet

On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
For Each wks In Me.Parent.Worksheets
For iCtr = 1 To 52
If LCase(wks.CodeName) = "sheet" & iCtr Then
wks.Name = Format(Target.Value + (7 * iCtr), "dd mmm YY")
Exit For
End If
Next iCtr
Next wks
End If

ws_exit:
Application.EnableEvents = True
End Sub

In Info!C4, I applied a data validation with the custom formula of
=weekday(C4)=1 and a warning that if the date input was not a Sunday, along
with the question Are you absolutely sure you wish to go ahead?
The problem starts here.
If I input in C4 a date that is not a Sunday, I get the question Are you
absolutely sure press yes and the tab name changes. When I then input a date
that is a Sunday, the tab name changes as normal.
If however I have in the cell a Sunday already, eg 1/1/06 and want to change
it to 8/1/06 then I do not get the tab name change. Please can someone tell
me why?
(using Excel XP)
I hope you can understand this logic.


Your help is and always has been very much appreciated.
Thanking you in anticipation.
--
Big Rick
 
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
Retreiving TABNAME from within a spreadsheet Bob Harike Excel Discussion (Misc queries) 2 February 2nd 05 09:35 PM


All times are GMT +1. The time now is 11:40 PM.

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"