Skip to content

Instantly share code, notes, and snippets.

@fdeitelhoff
Created November 8, 2013 13:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fdeitelhoff/7371165 to your computer and use it in GitHub Desktop.
Save fdeitelhoff/7371165 to your computer and use it in GitHub Desktop.
Calculate birthdays and visualize them in the 170 x 170 area of the Excel 2013 workbook.
private void CalculateBirthdays(int rows, int columns)
{
var days = 1;
var years = 1;
for (var row = 1; row <= rows; row++)
{
for (var column = 1; column <= columns; column++)
{
var cell = Cells[row, column] as Range;
if (cell != null && days % 365 == 0)
{
cell.Interior.Color = Color.Green;
Cells[row, column] = years;
years++;
}
days++;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment