Option Explicit
Sub BlankOutDAILYCIL()
Dim nLastRowA As Long
Dim nNextRowAP As Long
Dim Myrange As Range
Dim Ans As Integer
Dim iRow As Long
ActiveSheet.Range(Cells(ActiveCell.Row, 2), Cells(ActiveCell.Row, 14)).Interior.Color = vbRed
'ActiveSheet.Range(Cells(ActiveCell.Row, 2), Cells(ActiveCell.Row, 14)).Select
Ans = MsgBox("*************** WARNING ***************" & vbLf & "Are you sure you want to blank out:" & vbLf & _
"Row " & ActiveCell.Row & vbLf & Cells(ActiveCell.Row, "B").Value & "-" & Cells(ActiveCell.Row, "A").Text & Cells(ActiveCell.Row - 1, "A").Text, vbYesNo, "Rychiger Operator")
''If yes then proceed
If Not Ans = vbYes Then Exit Sub
With Application
.ScreenUpdating = False
.DisplayAlerts = False
With Worksheets("DAILY_CIL")
'Exit if the row is NOT a data line
' If iRow <= 6 Then
' Exit Sub
' End If
'Disable Excel Events
Application.EnableEvents = False
'Unprotect the Sheet
Call UnprotectTheActiveSheet
nLastRowA = .Cells(Rows.Count, "D").End(xlUp).Row + 1
nNextRowAP = .Cells(Rows.Count, "D").End(xlUp).Row + 1
.Range(.Cells(nNextRowAP, "L"), .Cells(nLastRowA, "L")).Select
ActiveCell.Offset(0, 0) = "X"
.Range(.Cells(nNextRowAP, "J"), .Cells(nLastRowA, "K")).Select
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Selection.Merge
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlMedium
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlMedium
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlMedium
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlMedium
End With
Selection.Borders(xlInsideVertical).LineStyle = xlNone
Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
With Selection.Font
.ThemeColor = xlThemeColorLight1
.TintAndShade = 0
End With
ActiveCell.Offset(0, 0) = "NOT FILLED OUT BY PREVIOUS SHIFT!"
Selection.Font.Underline = xlUnderlineStyleNone
.Range(.Cells(nNextRowAP, "I"), .Cells(nLastRowA, "I")).Select
Selection.FormatConditions.Delete
.Range(.Cells(nNextRowAP, "C"), .Cells(nLastRowA, "C")).Select
ActiveCell.Offset(0, 0) = "N/A"
ActiveCell.Offset(0, 1) = "N/A"
ActiveCell.Offset(0, 2) = "N/A"
ActiveCell.Offset(0, 3) = "N/A"
ActiveCell.Offset(0, 4) = "N/A"
ActiveCell.Offset(0, 5) = "N/A"
ActiveCell.Offset(0, 6) = "N/A"
ActiveCell.Offset(0, 9) = "N/A"
ActiveCell.Offset(0, 10) = "N/A"
ActiveCell.Offset(0, 11) = "N/A"
Call FindNextRowDAILYCIL
'Protect the Sheet again
Call ProtectTheActiveSheet
'Enable Excel Events
Application.EnableEvents = True
'End If
End With
With Application
.ScreenUpdating = True
.DisplayAlerts = True
End With
End With
End Sub