Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Macro to colur tabs based on cel value

Need help in developing a macro that will colour the sheet tab based on
the sheet name or cell value in a sheet that is equal to, for example,
saturday or sunday. For example, Oct 2, 2005 - SUN. I have 31 sheets
for each day of the month, named 1, 2, 3, etc... Having the sheets
colour coded just makes it visually easier to select the proper sheet.

Any suggestions would be appreciated.

Thanks you.

Terry

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Macro to colur tabs based on cel value

You can try this example with sheets named 1 ,2 ......

Sub test()
Dim sh As Worksheet
Dim monthnum As Integer
Dim yearnum As Integer

monthnum = 10
yearnum = 2005

For Each sh In ActiveWorkbook.Worksheets
If sh.Visible = -1 Then
If Application.WorksheetFunction.Weekday(DateSerial(y earnum, monthnum, sh.Name), 2) 5 Then
sh.Tab.ColorIndex = 3
Else
sh.Tab.ColorIndex = -4142
End If
End If
Next sh
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


wrote in message ups.com...
Need help in developing a macro that will colour the sheet tab based on
the sheet name or cell value in a sheet that is equal to, for example,
saturday or sunday. For example, Oct 2, 2005 - SUN. I have 31 sheets
for each day of the month, named 1, 2, 3, etc... Having the sheets
colour coded just makes it visually easier to select the proper sheet.

Any suggestions would be appreciated.

Thanks you.

Terry



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Macro to colur tabs based on cel value

Brilliant - Just what I needed.

Thank you.

Terry

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Macro to colur tabs based on cel value

Ron,

Is there a way monthnum and yearnum refer to values on a sheet vs.
changing it in the code?

Thanks,

Terry

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Macro to colur tabs based on cel value

Hi Terry

Is there a way monthnum and yearnum refer to values on a sheet vs.
changing it in the code?


Sure

monthnum = Sheets("1").Range("A1")
yearnum = Sheets("1").Range("A2")

Maybe you must change the sheet name ?



--
Regards Ron de Bruin
http://www.rondebruin.nl


wrote in message oups.com...
Ron,

Is there a way monthnum and yearnum refer to values on a sheet vs.
changing it in the code?

Thanks,

Terry





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
vlook on different tabs based on value jatman Excel Worksheet Functions 1 May 5th 10 06:48 PM
Vlookup Different tabs based on Dates andy Excel Worksheet Functions 5 April 23rd 09 04:53 PM
Code to hide tabs based on input newguy Excel Discussion (Misc queries) 2 September 16th 08 02:20 PM
sum numbers of a different colur in a row of data pjenz Excel Worksheet Functions 4 September 14th 07 09:46 PM
No colur in normal view but is in print preview Lenoire77 Excel Discussion (Misc queries) 2 June 20th 06 08:36 AM


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