Public Sub Vacation_Time()
'Delete out of date vacation days
For Each cell In Sheets("All").Range("E4:IT300")
If cell.Value = "v" Then cell.ClearContents
Next
For Each cell In Sheets("PMDavid H").Range("E4:IT39")
If cell.Value = "v" Then cell.ClearContents
Next
For Each cell In Sheets("PMDave S").Range("E4:IT39")
If cell.Value = "v" Then cell.ClearContents
Next
For Each cell In Sheets("PMTony").Range("E4:IT39")
If cell.Value = "v" Then cell.ClearContents
Next
For Each cell In Sheets("PMSante").Range("E4:IT39")
If cell.Value = "v" Then cell.ClearContents
Next
For Each cell In Sheets("PMNate").Range("E4:IT39")
If cell.Value = "v" Then cell.ClearContents
Next
For Each cell In Sheets("PMKurt").Range("E4:IT39")
If cell.Value = "v" Then cell.ClearContents
Next
For Each cell In Sheets("ENGKeenan").Range("E4:IT39")
If cell.Value = "v" Then cell.ClearContents
Next
For Each cell In Sheets("ENGJustin").Range("E4:IT39")
If cell.Value = "v" Then cell.ClearContents
Next
For Each cell In Sheets("ENGJeff").Range("E4:IT39")
If cell.Value = "v" Then cell.ClearContents
Next
With Worksheets("Home")
If Range("W6").Value = "True" Then
BlackOut .Range("L6").Value, .Range("N6").Value, Worksheets("PMDavid H")
End If
If Range("W8").Value = "True" Then
BlackOut .Range("L8").Value, .Range("N8").Value, Worksheets("PMDave S")
End If
If Range("W10").Value = "True" Then
BlackOut .Range("L10").Value, .Range("N10").Value, Worksheets("PMTony")
End If
If Range("W12").Value = "True" Then
BlackOut .Range("L12").Value, .Range("N12").Value, Worksheets("PMSante")
End If
If Range("W14").Value = "True" Then
BlackOut .Range("L14").Value, .Range("N14").Value, Worksheets("PMNate")
End If
If Range("W16").Value = "True" Then
BlackOut .Range("L16").Value, .Range("N16").Value, Worksheets("PMKurt")
End If
If Range("W18").Value = "True" Then
BlackOut .Range("L18").Value, .Range("N18").Value, Worksheets("ENGKeenan")
End If
If Range("W20").Value = "True" Then
BlackOut .Range("L20").Value, .Range("N20").Value, Worksheets("ENGJustin")
End If
If Range("W22").Value = "True" Then
BlackOut .Range("L22").Value, .Range("N22").Value, Worksheets("ENGJeff")
End If
End With
With Worksheets("Home")
If Range("W6").Value = "True" Then
BlackOut2 .Range("L6").Value, .Range("N6").Value, Worksheets("All")
End If
If Range("W8").Value = "True" Then
BlackOut3 .Range("L8").Value, .Range("N8").Value, Worksheets("All")
End If
If Range("W10").Value = "True" Then
BlackOut4 .Range("L10").Value, .Range("N10").Value, Worksheets("All")
End If
If Range("W12").Value = "True" Then
BlackOut5 .Range("L12").Value, .Range("N12").Value, Worksheets("All")
End If
If Range("W14").Value = "True" Then
BlackOut6 .Range("L14").Value, .Range("N14").Value, Worksheets("All")
End If
If Range("W16").Value = "True" Then
BlackOut7 .Range("L16").Value, .Range("N16").Value, Worksheets("All")
End If
End With
Application.ScreenUpdating = True
End Sub
Sub BlackOut(dbStart As Date, dbEnd As Date, ws As Worksheet)
Dim nCol As Long, nRow As Long
Dim dt As Date
With ws
For nCol = Columns("E").Column To Columns("IT").Column
dt = .Cells(2, nCol)
If dt >= dbStart And dt <= dbEnd Then
For nRow = 4 To 39
.Cells(nRow, nCol) = "v"
Next nRow
End If
Next nCol
End With
End Sub
Sub BlackOut2(dbStart As Date, dbEnd As Date, ws As Worksheet)
Dim nCol As Long, nRow As Long
Dim dt As Date
With ws
For nCol = Columns("E").Column To Columns("IT").Column
dt = .Cells(2, nCol)
If dt >= dbStart And dt <= dbEnd Then
For nRow = 4 To 300
If Range("D" & nRow).Value = "David H...." Then
.Cells(nRow, nCol) = "v"
End If
Next nRow
End If
Next nCol
End With
End Sub
Sub BlackOut3(dbStart As Date, dbEnd As Date, ws As Worksheet)
Dim nCol As Long, nRow As Long
Dim dt As Date
With ws
For nCol = Columns("E").Column To Columns("IT").Column
dt = .Cells(2, nCol)
If dt >= dbStart And dt <= dbEnd Then
For nRow = 4 To 300
If Range("D" & nRow).Value = "Dave S....." Then
.Cells(nRow, nCol) = "v"
End If
Next nRow
End If
Next nCol
End With
End Sub
Sub BlackOut4(dbStart As Date, dbEnd As Date, ws As Worksheet)
Dim nCol As Long, nRow As Long
Dim dt As Date
With ws
For nCol = Columns("E").Column To Columns("IT").Column
dt = .Cells(2, nCol)
If dt >= dbStart And dt <= dbEnd Then
For nRow = 4 To 300
If Range("D" & nRow).Value = "Tony" Then
.Cells(nRow, nCol) = "v"
End If
Next nRow
End If
Next nCol
End With
End Sub
Sub BlackOut5(dbStart As Date, dbEnd As Date, ws As Worksheet)
Dim nCol As Long, nRow As Long
Dim dt As Date
With ws
For nCol = Columns("E").Column To Columns("IT").Column
dt = .Cells(2, nCol)
If dt >= dbStart And dt <= dbEnd Then
For nRow = 4 To 300
If Range("D" & nRow).Value = "Sante" Then
.Cells(nRow, nCol) = "v"
End If
Next nRow
End If
Next nCol
End With
End Sub
Sub BlackOut6(dbStart As Date, dbEnd As Date, ws As Worksheet)
Dim nCol As Long, nRow As Long
Dim dt As Date
With ws
For nCol = Columns("E").Column To Columns("IT").Column
dt = .Cells(2, nCol)
If dt >= dbStart And dt <= dbEnd Then
For nRow = 4 To 300
If Range("D" & nRow).Value = "Nate" Then
.Cells(nRow, nCol) = "v"
End If
Next nRow
End If
Next nCol
End With
End Sub
Sub BlackOut7(dbStart As Date, dbEnd As Date, ws As Worksheet)
Dim nCol As Long, nRow As Long
Dim dt As Date
With ws
For nCol = Columns("E").Column To Columns("IT").Column
dt = .Cells(2, nCol)
If dt >= dbStart And dt <= dbEnd Then
For nRow = 4 To 300
If Range("D" & nRow).Value = "Kurt" Then
.Cells(nRow, nCol) = "v"
End If
Next nRow
End If
Next nCol
End With
End Sub
As you can see it first empties all sheets of and "v" values, then it goes through your BlackOut function. Then I tried altering it to make it search through the "All" sheet for a given individual and the dates they are out. Hopefully you can provide some guidance. I feel as though it's close but I can't understand if it's just declarations or something. Thanks for all of your help so far!
Bookmarks