Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default Formatting a Calendar

I need to format a calendar that changes the cell color every two days (for a
total of eight colors) for the entire year of 2009, but I can't find a way to
do it. In other words, the first two days the cells are brown, the second
two days the cells are light blue, the third two days the cells are pink,
fourth = yellow, fifth = dark blue, sixth = light green, seventh = dark
green, and eighth = orange.

Is there a way to do this and repeat it until the end of the year?

For logic purposes, this is for a days' off schedule. There are eight
groups of employees and the groups have two days off for each time their
color lands on the calendar.
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5,441
Default Formatting a Calendar

Select your cells and run this macro:

Sub TryNow()
Dim myC As Range
Dim i As Integer
Dim myColor As Integer
Dim myArray As Variant
myArray = Array(34, 35, 6, 40, 37, 39, 38, 15)
For Each myC In Selection
i = Int((myC.Value Mod 16) / 2)
myColor = myArray(i)
myC.Interior.ColorIndex = myColor
Next myC
End Sub

Change the 34, 35, 6, 40, 37, 39, 38, 15 to the colorindex values that you want to use.

And, if the days are not grouped properly, change

i = Int((myC.Value Mod 16) / 2)
to
i = Int(((myC.Value+1) Mod 16) / 2)

HTH,
Bernie
MS Excel MVP


"rarmont" wrote in message
...
I need to format a calendar that changes the cell color every two days (for a
total of eight colors) for the entire year of 2009, but I can't find a way to
do it. In other words, the first two days the cells are brown, the second
two days the cells are light blue, the third two days the cells are pink,
fourth = yellow, fifth = dark blue, sixth = light green, seventh = dark
green, and eighth = orange.

Is there a way to do this and repeat it until the end of the year?

For logic purposes, this is for a days' off schedule. There are eight
groups of employees and the groups have two days off for each time their
color lands on the calendar.



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
find free sharware to include calendar pop or use calendar in cell ednc Excel Discussion (Misc queries) 2 April 14th 08 05:05 PM
how do i export excel calendar info to outlook calendar? Maggie Excel Discussion (Misc queries) 1 December 31st 07 10:27 PM
excel calendar - list of names displayed on calendar Brian'88 Excel Worksheet Functions 3 November 17th 06 10:31 PM
import calendar items from excel into outlook calendar jsewaiseh Excel Discussion (Misc queries) 0 September 2nd 05 03:53 PM
calendar control - formatting arnoldarmy Excel Discussion (Misc queries) 1 April 25th 05 04:36 PM


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