thank you very much to those who answered my original question. I'd like to go into a little more detail about the problem I am having. I am working on a macros that provides a visual representation of the 4 different production phases of a product we produce. The spreadsheet is set up to appear as a linear calendar, showing all 365 days of the year and grouping them into calendar weeks. Each production phases has a different color associated with it. The four buildphases are: 1) Assembly: 1 day (yellow) 2) Initial analysis: 1 day (purple) 3) In-depth analysis: 7 days (green) 4) Shipping: 1 day (red)
No work is performed in the facility on weekends or holidays. Saturdays and sundays are represented by a cell colored black and holidays are represented by cells colored orange and having a criss cross pattern. The macro is designed to skip these holidays using the following if then statement:
Dim i As Integer
i = Analysis days
for i = 1 to 7
ActiveCell.Select
If Selection.Interior.Pattern = x1CrissCross And Selection.Interior.Color = orange Then
ActiveCell.Offset(0, 1).Select
Else: ActiveCell.Select
End If
If Selection.Interior.Color = black Then
ActiveCell.Offset(0, 2).Select
Else: ActiveCell.Select
End If.
The If Then statement that tells the macro to skip Saturday and Sunday works every time. But the statement that tells the macro to skip holidays only works part of the time, and if the holidays last longer than a few days (Christmas vacation lasts nine days) the macro inserts production work days interspersed throughout the holiday. I've found that by copying and pasting the above statements directly beneath one another several times seems to fix the issue. But I am sure there has to be a more efficient way to do this. Does anyone know of a way I can fix the issue without having to copy and paste the same lines of code mulitple times?
Thanks in advance!