Private [COLOR="Navy"]Sub[/COLOR] Worksheet_Change(ByVal Target [COLOR="Navy"]As[/COLOR] Range)
[COLOR="Navy"]Dim[/COLOR] Rng [COLOR="Navy"]As[/COLOR] Range, Dn [COLOR="Navy"]As[/COLOR] Range
[COLOR="Navy"]Dim[/COLOR] nDn [COLOR="Navy"]As[/COLOR] Range
[COLOR="Navy"]Dim[/COLOR] Msg [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]String[/COLOR]
[COLOR="Navy"]Dim[/COLOR] nMsg [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]String[/COLOR]
[COLOR="Navy"]Dim[/COLOR] nRng [COLOR="Navy"]As[/COLOR] Range
[COLOR="Navy"]Dim[/COLOR] Depot [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]String[/COLOR]
[COLOR="Navy"]Dim[/COLOR] Fd [COLOR="Navy"]As[/COLOR] Boolean
[COLOR="Navy"]Dim[/COLOR] nFd [COLOR="Navy"]As[/COLOR] Boolean
[COLOR="Navy"]If[/COLOR] Target.Count = 1 And Not Intersect(Target, Range("A1:CB316")) [COLOR="Navy"]Is[/COLOR] Nothing [COLOR="Navy"]Then[/COLOR]
[COLOR="Navy"]Set[/COLOR] Rng = Range(Range("C3"), Cells(3, Columns.Count).End(xlToLeft))
[COLOR="Navy"]Set[/COLOR] Rng = Rng.SpecialCells(xlCellTypeConstants)
[COLOR="Navy"]For[/COLOR] [COLOR="Navy"]Each[/COLOR] Dn [COLOR="Navy"]In[/COLOR] Rng.Areas
[COLOR="Navy"]If[/COLOR] nRng [COLOR="Navy"]Is[/COLOR] Nothing [COLOR="Navy"]Then[/COLOR]
[COLOR="Navy"]Set[/COLOR] nRng = Dn.Offset(Target.Row - 3)
[COLOR="Navy"]Else[/COLOR]
[COLOR="Navy"]Set[/COLOR] nRng = Union(nRng, Dn.Offset(Target.Row - 3))
[COLOR="Navy"]End[/COLOR] If
[COLOR="Navy"]Next[/COLOR] Dn
[COLOR="Navy"]For[/COLOR] [COLOR="Navy"]Each[/COLOR] nDn [COLOR="Navy"]In[/COLOR] nRng.Areas
[COLOR="Navy"]If[/COLOR] Not Intersect(Target, nDn) [COLOR="Navy"]Is[/COLOR] Nothing [COLOR="Navy"]Then[/COLOR] Fd = True
[COLOR="Navy"]Next[/COLOR] nDn
[COLOR="Navy"]If[/COLOR] Fd [COLOR="Navy"]Then[/COLOR]
[COLOR="Navy"]For[/COLOR] [COLOR="Navy"]Each[/COLOR] nDn [COLOR="Navy"]In[/COLOR] nRng.Areas
Depot = IIf(nDn(1).Column = 3, nDn(1).Offset(-Target.Row + 1), nDn(1).Offset(-Target.Row + 1, -1))
[COLOR="Navy"]For[/COLOR] [COLOR="Navy"]Each[/COLOR] Dn [COLOR="Navy"]In[/COLOR] nDn
[COLOR="Navy"]If[/COLOR] Target = "HP" And Dn <> "" And Not Dn.Address = Target.Address [COLOR="Navy"]Then[/COLOR]
Msg = Msg & Cells(3, Dn.Column) & Chr(10)
nFd = True
[COLOR="Navy"]End[/COLOR] If
[COLOR="Navy"]Next[/COLOR] Dn
nMsg = nMsg & """" & Depot & """" & Chr(10) & Msg & Chr(10)
Msg = ""
[COLOR="Navy"]Next[/COLOR] nDn
[COLOR="Navy"]End[/COLOR] If
[COLOR="Navy"]If[/COLOR] nFd And Target = "HP" [COLOR="Navy"]Then[/COLOR]
MsgBox "The following Staff are off today " & Chr(10) & Chr(10) & nMsg & Chr(10) & "Press ""OK"" to continue !!"
[COLOR="Navy"]End[/COLOR] If
[COLOR="Navy"]Dim[/COLOR] intclr [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]Integer[/COLOR]
[COLOR="Navy"]If[/COLOR] Target.Count > 1 [COLOR="Navy"]Then[/COLOR] [COLOR="Navy"]Exit[/COLOR] [COLOR="Navy"]Sub[/COLOR]
[COLOR="Navy"]Select[/COLOR] [COLOR="Navy"]Case[/COLOR] Target
[COLOR="Navy"]Case[/COLOR] "HP": intclr = 40
[COLOR="Navy"]Case[/COLOR] "MP": intclr = 36
[COLOR="Navy"]Case[/COLOR] "SU": intclr = 35
[COLOR="Navy"]Case[/COLOR] "BH": intclr = 37
[COLOR="Navy"]Case[/COLOR] "HU": intclr = 43
[COLOR="Navy"]Case[/COLOR] "RD": intclr = 42
[COLOR="Navy"]Case[/COLOR] "": intclr = xlNone
[COLOR="Navy"]Case[/COLOR] [COLOR="Navy"]Else[/COLOR]
[COLOR="Navy"]End[/COLOR] Select
Target.Interior.ColorIndex = intclr
[COLOR="Navy"]End[/COLOR] If
[COLOR="Navy"]End[/COLOR] [COLOR="Navy"]Sub[/COLOR]