View Single Post
  #2   Report Post  
BizMark BizMark is offline
Member
 
Location: London
Posts: 78
Default

Quote:
Originally Posted by Mikus
Is it possible to change tab names dynamicaly ? For example i have 31 tab (1
for each day of the month)

These tabs are named - 1,2,3 e.t.c
Is it possible to define rule that would ad "!" to day which is weekend day.

In other words is it possible to dynamicly change tab name depending from
value of cell ?

If this is possbile how do i do this ?
You could add this routine to a module in the workbook:

Sub Auto_Open()
--For Each xSheet in ThisWorkbook.Worksheets
----nDay = Val(xSheet.Name) 'Use number in sheet tab to represent date
----dDate = DateSerial(Year(Now()),Month(Now()),nDay) 'Work out full date
----tDay = Format(dDate,"ddd") 'Work out which day it is
----'If day is SAT or SUN, add exclamation point
----If Left(tDay,1)="S" Then
------xSheet.Name = Format(nDay,"0") & "!"
----Else
------xSheet.Name = Format(nDay,"0")
----End If
--Next xSheet
End Sub

This will add an exclamation point symbol to any sheet tab representing a date which is a weekend day.

However, you could simply replace the 'If-Else-End If' section with:

----xSheet.Name = Format(dDate,"dd ddd")

And this will name your sheets:
'01 MON', '02 TUE', '03 WED', etc.

Hope this helps.
BizMark