Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Rename & Colour Sheet Q

Sub ColorTabs()

ColorBlue = 5
ColorYellow = 6

FirstDate = Sheets(1).Name
'replace undre score with slash
FirstDate = Replace(FirstDate, "_", "/")
ShtDate = DateValue(FirstDate)
ShtDate = ShtDate + 7

FirstColor = Sheets(1).Tab.ColorIndex

Select Case FirstColor
Case Color_Blue: ShtColor = ColorBlue
Case Color_Blue: ShtColor = ColorYellow
Case Else:
'if color doesn't match yellow or blue make blue
ShtColor = ColorBlue
Sheets(1).Tab.ColorIndex = ColorBlue
End Select

For ShtCount = 2 To Sheets.Count
With Sheets(ShtCount)
.Name = Format(ShtDate, "DD_MM_YY")
ShtDate = ShtDate + 7
Select Case ShtColor
Case ColorBlue:
ShtColor = ColorYellow
.Tab.ColorIndex = ShtColor
Case ColorYellow:
ShtColor = ColorBlue
.Tab.ColorIndex = ShtColor
End Select
End With
Next ShtCount
End Sub


"Seanie" wrote:

What code could I use to automate these two tasks:-

1) Change the Active Sheet tab colour to: Blue if the sheet
immediately to the left is Yellow or Yellow if the sheet immediately
to the left is Blue

2) Rename the Active Sheet to "the name of the sheet immediately to
the left" + 7. The format of the sheet is dd-mm-yy, so if the sheet to
the left is 17-05-09 my new Active Sheet would be 24-05-09

If (2) above is even possible

Thanks

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 202
Default Rename & Colour Sheet Q

Joel, that's fantastic, works like a dream

Thanks

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
how do i rename a sheet if the rename tab is inactive? Nelson Excel Worksheet Functions 1 March 3rd 10 10:28 AM
macro to: Add new sheet, then rename new sheet with todays date Paul Excel Worksheet Functions 3 September 29th 07 03:17 AM
Move data to new sheet - rename sheet based on criteria ? [email protected] Excel Discussion (Misc queries) 7 May 16th 07 10:22 PM
How to copy a sheet and rename it with the value of two cells from the source sheet? Simon Lloyd[_717_] Excel Programming 0 May 12th 06 01:31 AM
Button to copy sheet, rename sheet sequencially. foxgguy2005[_3_] Excel Programming 9 June 17th 05 01:41 PM


All times are GMT +1. The time now is 09:14 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"