Compile Error: Expected end of statement

IHaveAQuestion

New Member
Joined
Sep 3, 2014
Messages
1
Hi all,

I tried adding an Add-On tool to Excel that seems to have corrupted something. Now, every time I open or close Excel I get the following pop ups in Microsoft Visual Basic for Applications...

Code:
 sub File_Name()
Application.ScreenUpdating = False
'Find last cell
       ActiveSheet.UsedRange
       ActiveCell.SpecialCells(xlLastCell).Activate
        iRow = ActiveCell.Row
        iCol = ActiveCell.Column
        ilast = ActiveCell.Address
 'Check limit tool
  If Range(ilast).Offset(0, (1 - iCol)) <> "Count" Then
    MsgBox ("Limit Tool already used")
    Exit Sub
    Else
    'Add stats heading
     Range(ilast).Offset(2, (1 - iCol)) = "Upper Limit"
     Range(ilast).Offset(3, (1 - iCol)) = "Lower Limit"
     Range(ilast).Offset(4, (1 - iCol)) = "# of Exceedances"
   End If
iOs = 6
Range("C9").Select
On Error Resume Next
'Remove format
ActiveCell.PivotTable.MergeLabels = False
Set sday = Range("A9")
Set stime = Range("B9")
Grp1 ilast, iCol, iRow, iOs, sday, stime
Grp2 ilast, iCol, iRow, iOs, sday, stime
'Format table
Range("C9").Select
ActiveCell.PivotTable.MergeLabels = True
 Rows("5:5").Select
       With Selection
        .RowHeight = 75
        .HorizontalAlignment = xlCenter
        .Orientation = 90
        .AddIndent = False
        .IndentLevel = 0
        .ShrinkToFit = False
        .ReadingOrder = xlContext
       End With
        Rows("6:6").Select
       With Selection
        .RowHeight = 50
       End With
Application.ScreenUpdating = True
End Sub
Sub Grp1(ilast, iCol, iRow, iOs, sday, stime)
On Error Resume Next
Set C = ActiveCell.PivotTable.GetPivotData("Result", "Location", "EFF-001", "Parameter", "Biochemical Oxygen Demand (BOD) (5-day @ 20 Deg. C)", _
"Calculation Type", "Monthly Average (Mean)", "Qual", "=", "Units", "mg/L", "Sampling Date", sday, "Sampling time", stime)
   If C Is Nothing Then
Set C = ActiveCell.PivotTable.GetPivotData("Result", "Location", "EFF-001", "Parameter", "Biochemical Oxygen Demand (BOD) (5-day @ 20 Deg. C)", _
"Calculation Type", "Monthly Average (Mean)", "Units", "mg/L", "Sampling Date", sday, "Sampling time", stime)
    End If
   If C Is Nothing Then
    Range(ilast).Offset(iOs, (1 - iCol)) = "EFF-001 / Biochemical Oxygen Demand (BOD) (5-day @ 20 Deg. C) / Monthly Average (Mean) / mg/L NOT found"
    Range(ilast).Offset(iOs, (1 - iCol)).Font.Color = -16383844
      iOs = iOs + 1
    Else:
        C.Activate
        ActiveCell.Offset(iRow - 5, 0) = "=COUNTIF(R[" & (-iRow + 5) & "]C:R[-9]C, "">"" &R[-2]C)+ COUNTIF(R[" & (-iRow + 5) & "]C:R[-9]C, ""<"" &R[-1]C)"
    ActiveCell.Offset(iRow - 7, 0) = 30
        With ActiveCell.Resize(Selection.Rows.Count + (iRow - 14), Selection.Columns.Count)
            .FormatConditions.Add Type:=xlCellValue, Operator:=xlEqual, Formula1:="=AND(COUNT(A2)=1,A2=0)"
            .FormatConditions.Add Type:=xlCellValue, Operator:=xlGreater, Formula1:="=" & ActiveCell.Offset(iRow - 7, 0).Address()
            .FormatConditions(2).Interior.ColorIndex = 3
            .FormatConditions.Add Type:=xlCellValue, Operator:=xlLess, Formula1:="=" & ActiveCell.Offset(iRow - 6, 0).Address()
            .FormatConditions(3).Interior.ColorIndex = 6
       End With
    End If
Set C = Nothing
Set C = ActiveCell.PivotTable.GetPivotData("Result", "Location", "EFF-001", "Parameter", "Biochemical Oxygen Demand (BOD) (5-day @ 20 Deg. C)", _
"Calculation Type", "Weekly Average (Mean)", "Qual", "=", "Units", "mg/L", "Sampling Date", sday, "Sampling time", stime)
   If C Is Nothing Then
Set C = ActiveCell.PivotTable.GetPivotData("Result", "Location", "EFF-001", "Parameter", "Biochemical Oxygen Demand (BOD) (5-day @ 20 Deg. C)", _
"Calculation Type", "Weekly Average (Mean)", "Units", "mg/L", "Sampling Date", sday, "Sampling time", stime)
    End If
   If C Is Nothing Then
    Range(ilast).Offset(iOs, (1 - iCol)) = "EFF-001 / Biochemical Oxygen Demand (BOD) (5-day @ 20 Deg. C) / Weekly Average (Mean) / mg/L NOT found"
    Range(ilast).Offset(iOs, (1 - iCol)).Font.Color = -16383844
      iOs = iOs + 1
    Else:
        C.Activate
        ActiveCell.Offset(iRow - 5, 0) = "=COUNTIF(R[" & (-iRow + 5) & "]C:R[-9]C, "">"" &R[-2]C)+ COUNTIF(R[" & (-iRow + 5) & "]C:R[-9]C, ""<"" &R[-1]C)"
    ActiveCell.Offset(iRow - 7, 0) = 45
        With ActiveCell.Resize(Selection.Rows.Count + (iRow - 14), Selection.Columns.Count)
            .FormatConditions.Add Type:=xlCellValue, Operator:=xlEqual, Formula1:="=AND(COUNT(A2)=1,A2=0)"
            .FormatConditions.Add Type:=xlCellValue, Operator:=xlGreater, Formula1:="=" & ActiveCell.Offset(iRow - 7, 0).Address()
            .FormatConditions(2).Interior.ColorIndex = 3
            .FormatConditions.Add Type:=xlCellValue, Operator:=xlLess, Formula1:="=" & ActiveCell.Offset(iRow - 6, 0).Address()
            .FormatConditions(3).Interior.ColorIndex = 6
       End With
    End If
Set C = Nothing
Set C = ActiveCell.PivotTable.GetPivotData("Result", "Location", "EFF-001", "Parameter", "Total Suspended Solids (TSS)", _
"Calculation Type", "Monthly Average (Mean)", "Qual", "=", "Units", "mg/L", "Sampling Date", sday, "Sampling time", stime)
   If C Is Nothing Then
Set C = ActiveCell.PivotTable.GetPivotData("Result", "Location", "EFF-001", "Parameter", "Total Suspended Solids (TSS)", _
"Calculation Type", "Monthly Average (Mean)", "Units", "mg/L", "Sampling Date", sday, "Sampling time", stime)
    End If
   If C Is Nothing Then
    Range(ilast).Offset(iOs, (1 - iCol)) = "EFF-001 / Total Suspended Solids (TSS) / Monthly Average (Mean) / mg/L NOT found"
    Range(ilast).Offset(iOs, (1 - iCol)).Font.Color = -16383844
      iOs = iOs + 1
    Else:
        C.Activate
        ActiveCell.Offset(iRow - 5, 0) = "=COUNTIF(R[" & (-iRow + 5) & "]C:R[-9]C, "">"" &R[-2]C)+ COUNTIF(R[" & (-iRow + 5) & "]C:R[-9]C, ""<"" &R[-1]C)"
    ActiveCell.Offset(iRow - 7, 0) = 30
        With ActiveCell.Resize(Selection.Rows.Count + (iRow - 14), Selection.Columns.Count)
            .FormatConditions.Add Type:=xlCellValue, Operator:=xlEqual, Formula1:="=AND(COUNT(A2)=1,A2=0)"
            .FormatConditions.Add Type:=xlCellValue, Operator:=xlGreater, Formula1:="=" & ActiveCell.Offset(iRow - 7, 0).Address()
            .FormatConditions(2).Interior.ColorIndex = 3
            .FormatConditions.Add Type:=xlCellValue, Operator:=xlLess, Formula1:="=" & ActiveCell.Offset(iRow - 6, 0).Address()
            .FormatConditions(3).Interior.ColorIndex = 6
       End With
    End If
Set C = Nothing
Set C = ActiveCell.PivotTable.GetPivotData("Result", "Location", "EFF-001", "Parameter", "Total Suspended Solids (TSS)", _
"Calculation Type", "Weekly Average (Mean)", "Qual", "=", "Units", "mg/L", "Sampling Date", sday, "Sampling time", stime)
   If C Is Nothing Then
Set C = ActiveCell.PivotTable.GetPivotData("Result", "Location", "EFF-001", "Parameter", "Total Suspended Solids (TSS)", _
"Calculation Type", "Weekly Average (Mean)", "Units", "mg/L", "Sampling Date", sday, "Sampling time", stime)
    End If
   If C Is Nothing Then
    Range(ilast).Offset(iOs, (1 - iCol)) = "EFF-001 / Total Suspended Solids (TSS) / Weekly Average (Mean) / mg/L NOT found"
    Range(ilast).Offset(iOs, (1 - iCol)).Font.Color = -16383844
      iOs = iOs + 1
    Else:
        C.Activate
        ActiveCell.Offset(iRow - 5, 0) = "=COUNTIF(R[" & (-iRow + 5) & "]C:R[-9]C, "">"" &R[-2]C)+ COUNTIF(R[" & (-iRow + 5) & "]C:R[-9]C, ""<"" &R[-1]C)"
    ActiveCell.Offset(iRow - 7, 0) = 45
        With ActiveCell.Resize(Selection.Rows.Count + (iRow - 14), Selection.Columns.Count)
            .FormatConditions.Add Type:=xlCellValue, Operator:=xlEqual, Formula1:="=AND(COUNT(A2)=1,A2=0)"
            .FormatConditions.Add Type:=xlCellValue, Operator:=xlGreater, Formula1:="=" & ActiveCell.Offset(iRow - 7, 0).Address()
            .FormatConditions(2).Interior.ColorIndex = 3
            .FormatConditions.Add Type:=xlCellValue, Operator:=xlLess, Formula1:="=" & ActiveCell.Offset(iRow - 6, 0).Address()
            .FormatConditions(3).Interior.ColorIndex = 6
       End With
    End If
Set C = Nothing
Set C = ActiveCell.PivotTable.GetPivotData("Result", "Location", "EFF-001", "Parameter", "Biochemical Oxygen Demand (BOD) (5-day @ 20 Deg. C)", _
"Calculation Type", "Monthly Average (Mean)", "Qual", "=", "Units", "%", "Sampling Date", sday, "Sampling time", stime)
   If C Is Nothing Then
Set C = ActiveCell.PivotTable.GetPivotData("Result", "Location", "EFF-001", "Parameter", "Biochemical Oxygen Demand (BOD) (5-day @ 20 Deg. C)", _
"Calculation Type", "Monthly Average (Mean)", "Units", "%", "Sampling Date", sday, "Sampling time", stime)
    End If
   If C Is Nothing Then
    Range(ilast).Offset(iOs, (1 - iCol)) = "EFF-001 / Biochemical Oxygen Demand (BOD) (5-day @ 20 Deg. C) / Monthly Average (Mean) / % NOT found"
    Range(ilast).Offset(iOs, (1 - iCol)).Font.Color = -16383844
      iOs = iOs + 1
    Else:
        C.Activate
        ActiveCell.Offset(iRow - 5, 0) = "=COUNTIF(R[" & (-iRow + 5) & "]C:R[-9]C, "">"" &R[-2]C)+ COUNTIF(R[" & (-iRow + 5) & "]C:R[-9]C, ""<"" &R[-1]C)"
    ActiveCell.Offset(iRow - 6, 0) = 85
        With ActiveCell.Resize(Selection.Rows.Count + (iRow - 14), Selection.Columns.Count)
            .FormatConditions.Add Type:=xlCellValue, Operator:=xlEqual, Formula1:="=AND(COUNT(A2)=1,A2=0)"
            .FormatConditions.Add Type:=xlCellValue, Operator:=xlGreater, Formula1:="=" & ActiveCell.Offset(iRow - 7, 0).Address()
            .FormatConditions(2).Interior.ColorIndex = 3
            .FormatConditions.Add Type:=xlCellValue, Operator:=xlLess, Formula1:="=" & ActiveCell.Offset(iRow - 6, 0).Address()
            .FormatConditions(3).Interior.ColorIndex = 6
       End With
    End If
Set C = Nothing
Set C = ActiveCell.PivotTable.GetPivotData("Result", "Location", "EFF-001", "Parameter", "Total Suspended Solids (TSS)", _
"Calculation Type", "Monthly Average (Mean)", "Qual", "=", "Units", "%", "Sampling Date", sday, "Sampling time", stime)
   If C Is Nothing Then
Set C = ActiveCell.PivotTable.GetPivotData("Result", "Location", "EFF-001", "Parameter", "Total Suspended Solids (TSS)", _
"Calculation Type", "Monthly Average (Mean)", "Units", "%", "Sampling Date", sday, "Sampling time", stime)
    End If
   If C Is Nothing Then
    Range(ilast).Offset(iOs, (1 - iCol)) = "EFF-001 / Total Suspended Solids (TSS) / Monthly Average (Mean) / % NOT found"
    Range(ilast).Offset(iOs, (1 - iCol)).Font.Color = -16383844
      iOs = iOs + 1
    Else:
        C.Activate
        ActiveCell.Offset(iRow - 5, 0) = "=COUNTIF(R[" & (-iRow + 5) & "]C:R[-9]C, "">"" &R[-2]C)+ COUNTIF(R[" & (-iRow + 5) & "]C:R[-9]C, ""<"" &R[-1]C)"
    ActiveCell.Offset(iRow - 6, 0) = 85
        With ActiveCell.Resize(Selection.Rows.Count + (iRow - 14), Selection.Columns.Count)
            .FormatConditions.Add Type:=xlCellValue, Operator:=xlEqual, Formula1:="=AND(COUNT(A2)=1,A2=0)"
            .FormatConditions.Add Type:=xlCellValue, Operator:=xlGreater, Formula1:="=" & ActiveCell.Offset(iRow - 7, 0).Address()
            .FormatConditions(2).Interior.ColorIndex = 3
            .FormatConditions.Add Type:=xlCellValue, Operator:=xlLess, Formula1:="=" & ActiveCell.Offset(iRow - 6, 0).Address()
            .FormatConditions(3).Interior.ColorIndex = 6
       End With
    End If
Set C = Nothing
Set C = ActiveCell.PivotTable.GetPivotData("Result", "Location", "EFF-001", "Parameter", "Oil and Grease", _
"Calculation Type", "Average Monthly (AMEL)", "Qual", "=", "Units", "mg/L", "Sampling Date", sday, "Sampling time", stime)
   If C Is Nothing Then
Set C = ActiveCell.PivotTable.GetPivotData("Result", "Location", "EFF-001", "Parameter", "Oil and Grease", _
"Calculation Type", "Average Monthly (AMEL)", "Units", "mg/L", "Sampling Date", sday, "Sampling time", stime)
    End If
   If C Is Nothing Then
    Range(ilast).Offset(iOs, (1 - iCol)) = "EFF-001 / Oil and Grease / Average Monthly (AMEL) / mg/L NOT found"
    Range(ilast).Offset(iOs, (1 - iCol)).Font.Color = -16383844
      iOs = iOs + 1
    Else:
        C.Activate
        ActiveCell.Offset(iRow - 5, 0) = "=COUNTIF(R[" & (-iRow + 5) & "]C:R[-9]C, "">"" &R[-2]C)+ COUNTIF(R[" & (-iRow + 5) & "]C:R[-9]C, ""<"" &R[-1]C)"
    ActiveCell.Offset(iRow - 7, 0) = 10
        With ActiveCell.Resize(Selection.Rows.Count + (iRow - 14), Selection.Columns.Count)
            .FormatConditions.Add Type:=xlCellValue, Operator:=xlEqual, Formula1:="=AND(COUNT(A2)=1,A2=0)"
            .FormatConditions.Add Type:=xlCellValue, Operator:=xlGreater, Formula1:="=" & ActiveCell.Offset(iRow - 7, 0).Address()
            .FormatConditions(2).Interior.ColorIndex = 3
            .FormatConditions.Add Type:=xlCellValue, Operator:=xlLess, Formula1:="=" & ActiveCell.Offset(iRow - 6, 0).Address()
            .FormatConditions(3).Interior.ColorIndex = 6
       End With
    End If
Set C = Nothing
Set C = ActiveCell.PivotTable.GetPivotData("Result", "Location", "EFF-001", "Parameter", "Oil and Grease", _
"Calculation Type", "Single", "Qual", "=", "Units", "mg/L", "Sampling Date", sday, "Sampling time", stime)
   If C Is Nothing Then
Set C = ActiveCell.PivotTable.GetPivotData("Result", "Location", "EFF-001", "Parameter", "Oil and Grease", _
"Calculation Type", "Single", "Units", "mg/L", "Sampling Date", sday, "Sampling time", stime)
    End If
   If C Is Nothing Then
    Range(ilast).Offset(iOs, (1 - iCol)) = "EFF-001 / Oil and Grease / Single / mg/L NOT found"
    Range(ilast).Offset(iOs, (1 - iCol)).Font.Color = -16383844
      iOs = iOs + 1
    Else:
        C.Activate
        ActiveCell.Offset(iRow - 5, 0) = "=COUNTIF(R[" & (-iRow + 5) & "]C:R[-9]C, "">"" &R[-2]C)+ COUNTIF(R[" & (-iRow + 5) & "]C:R[-9]C, ""<"" &R[-1]C)"
    ActiveCell.Offset(iRow - 7, 0) = 20
        With ActiveCell.Resize(Selection.Rows.Count + (iRow - 14), Selection.Columns.Count)
            .FormatConditions.Add Type:=xlCellValue, Operator:=xlEqual, Formula1:="=AND(COUNT(A2)=1,A2=0)"
            .FormatConditions.Add Type:=xlCellValue, Operator:=xlGreater, Formula1:="=" & ActiveCell.Offset(iRow - 7, 0).Address()
            .FormatConditions(2).Interior.ColorIndex = 3
            .FormatConditions.Add Type:=xlCellValue, Operator:=xlLess, Formula1:="=" & ActiveCell.Offset(iRow - 6, 0).Address()
            .FormatConditions(3).Interior.ColorIndex = 6
       End With
    End If
Set C = Nothing
Set C = ActiveCell.PivotTable.GetPivotData("Result", "Location", "EFF-001", "Parameter", "pH", _
"Calculation Type", "Daily Minimum", "Qual", "=", "Units", "SU", "Sampling Date", sday, "Sampling time", stime)
   If C Is Nothing Then
Set C = ActiveCell.PivotTable.GetPivotData("Result", "Location", "EFF-001", "Parameter", "pH", _
"Calculation Type", "Daily Minimum", "Units", "SU", "Sampling Date", sday, "Sampling time", stime)
    End If
   If C Is Nothing Then
    Range(ilast).Offset(iOs, (1 - iCol)) = "EFF-001 / pH / Daily Minimum / SU NOT found"
    Range(ilast).Offset(iOs, (1 - iCol)).Font.Color = -16383844
      iOs = iOs + 1
    Else:
        C.Activate
        ActiveCell.Offset(iRow - 5, 0) = "=COUNTIF(R[" & (-iRow + 5) & "]C:R[-9]C, "">"" &R[-2]C)+ COUNTIF(R[" & (-iRow + 5) & "]C:R[-9]C, ""<"" &R[-1]C)"
    ActiveCell.Offset(iRow - 6, 0) = 6.5
        With ActiveCell.Resize(Selection.Rows.Count + (iRow - 14), Selection.Columns.Count)
            .FormatConditions.Add Type:=xlCellValue, Operator:=xlEqual, Formula1:="=AND(COUNT(A2)=1,A2=0)"
            .FormatConditions.Add Type:=xlCellValue, Operator:=xlGreater, Formula1:="=" & ActiveCell.Offset(iRow - 7, 0).Address()
            .FormatConditions(2).Interior.ColorIndex = 3
            .FormatConditions.Add Type:=xlCellValue, Operator:=xlLess, Formula1:="=" & ActiveCell.Offset(iRow - 6, 0).Address()
            .FormatConditions(3).Interior.ColorIndex = 6
       End With
    End If
Set C = Nothing
Set C = ActiveCell.PivotTable.GetPivotData("Result", "Location", "EFF-001", "Parameter", "pH", _
"Calculation Type", "Daily Maximum", "Qual", "=", "Units", "SU", "Sampling Date", sday, "Sampling time", stime)
   If C Is Nothing Then
Set C = ActiveCell.PivotTable.GetPivotData("Result", "Location", "EFF-001", "Parameter", "pH", _
"Calculation Type", "Daily Maximum", "Units", "SU", "Sampling Date", sday, "Sampling time", stime)
    End If
   If C Is Nothing Then
    Range(ilast).Offset(iOs, (1 - iCol)) = "EFF-001 / pH / Daily Maximum / SU NOT found"
    Range(ilast).Offset(iOs, (1 - iCol)).Font.Color = -16383844
      iOs = iOs + 1
    Else:
        C.Activate
        ActiveCell.Offset(iRow - 5, 0) = "=COUNTIF(R[" & (-iRow + 5) & "]C:R[-9]C, "">"" &R[-2]C)+ COUNTIF(R[" & (-iRow + 5) & "]C:R[-9]C, ""<"" &R[-1]C)"
    ActiveCell.Offset(iRow - 7, 0) = 8.5
        With ActiveCell.Resize(Selection.Rows.Count + (iRow - 14), Selection.Columns.Count)
            .FormatConditions.Add Type:=xlCellValue, Operator:=xlEqual, Formula1:="=AND(COUNT(A2)=1,A2=0)"
            .FormatConditions.Add Type:=xlCellValue, Operator:=xlGreater, Formula1:="=" & ActiveCell.Offset(iRow - 7, 0).Address()
            .FormatConditions(2).Interior.ColorIndex = 3
            .FormatConditions.Add Type:=xlCellValue, Operator:=xlLess, Formula1:="=" & ActiveCell.Offset(iRow - 6, 0).Address()
            .FormatConditions(3).Interior.ColorIndex = 6
       End With
    End If
Set C = Nothing
Set C = ActiveCell.PivotTable.GetPivotData("Result", "Location", "EFF-001", "Parameter", "Chlorine, Total Residual", _
"Calculation Type", "Instantaneous Maximum (IMAX)", "Qual", "=", "Units", "mg/L", "Sampling Date", sday, "Sampling time", stime)
   If C Is Nothing Then
Set C = ActiveCell.PivotTable.GetPivotData("Result", "Location", "EFF-001", "Parameter", "Chlorine, Total Residual", _
"Calculation Type", "Instantaneous Maximum (IMAX)", "Units", "mg/L", "Sampling Date", sday, "Sampling time", stime)
    End If
   If C Is Nothing Then
    Range(ilast).Offset(iOs, (1 - iCol)) = "EFF-001 / Chlorine, Total Residual / Instantaneous Maximum (IMAX) / mg/L NOT found"
    Range(ilast).Offset(iOs, (1 - iCol)).Font.Color = -16383844
      iOs = iOs + 1
    Else:
        C.Activate
        ActiveCell.Offset(iRow - 5, 0) = "=COUNTIF(R[" & (-iRow + 5) & "]C:R[-9]C, "">"" &R[-2]C)+ COUNTIF(R[" & (-iRow + 5) & "]C:R[-9]C, ""<"" &R[-1]C)"
    ActiveCell.Offset(iRow - 7, 0) = 0
        With ActiveCell.Resize(Selection.Rows.Count + (iRow - 14), Selection.Columns.Count)
            .FormatConditions.Add Type:=xlCellValue, Operator:=xlEqual, Formula1:="=AND(COUNT(A2)=1,A2=0)"
            .FormatConditions.Add Type:=xlCellValue, Operator:=xlGreater, Formula1:="=" & ActiveCell.Offset(iRow - 7, 0).Address()
            .FormatConditions(2).Interior.ColorIndex = 3
            .FormatConditions.Add Type:=xlCellValue, Operator:=xlLess, Formula1:="=" & ActiveCell.Offset(iRow - 6, 0).Address()
            .FormatConditions(3).Interior.ColorIndex = 6
       End With
    End If
Set C = Nothing
Set C = ActiveCell.PivotTable.GetPivotData("Result", "Location", "EFF-001", "Parameter", "Enterococci", _
"Calculation Type", "Monthly Geometric mean", "Qual", "=", "Units", "MPN/100 mL", "Sampling Date", sday, "Sampling time", stime)
   If C Is Nothing Then
Set C = ActiveCell.PivotTable.GetPivotData("Result", "Location", "EFF-001", "Parameter", "Enterococci", _
"Calculation Type", "Monthly Geometric mean", "Units", "MPN/100 mL", "Sampling Date", sday, "Sampling time", stime)
    End If
   If C Is Nothing Then
    Range(ilast).Offset(iOs, (1 - iCol)) = "EFF-001 / Enterococci / Monthly Geometric mean / MPN/100 mL NOT found"
    Range(ilast).Offset(iOs, (1 - iCol)).Font.Color = -16383844
      iOs = iOs + 1
    Else:
        C.Activate
        ActiveCell.Offset(iRow - 5, 0) = "=COUNTIF(R[" & (-iRow + 5) & "]C:R[-9]C, "">"" &R[-2]C)+ COUNTIF(R[" & (-iRow + 5) & "]C:R[-9]C, ""<"" &R[-1]C)"
    ActiveCell.Offset(iRow - 7, 0) = 35
        With ActiveCell.Resize(Selection.Rows.Count + (iRow - 14), Selection.Columns.Count)
            .FormatConditions.Add Type:=xlCellValue, Operator:=xlEqual, Formula1:="=AND(COUNT(A2)=1,A2=0)"
            .FormatConditions.Add Type:=xlCellValue, Operator:=xlGreater, Formula1:="=" & ActiveCell.Offset(iRow - 7, 0).Address()
            .FormatConditions(2).Interior.ColorIndex = 3
            .FormatConditions.Add Type:=xlCellValue, Operator:=xlLess, Formula1:="=" & ActiveCell.Offset(iRow - 6, 0).Address()
            .FormatConditions(3).Interior.ColorIndex = 6
       End With
    End If
Set C = Nothing
Set C = ActiveCell.PivotTable.GetPivotData("Result", "Location", "EFF-001", "Parameter", "Copper, Total", _
"Calculation Type", "Average Monthly (AMEL)", "Qual", "=", "Units", "ug/L", "Sampling Date", sday, "Sampling time", stime)
   If C Is Nothing Then
Set C = ActiveCell.PivotTable.GetPivotData("Result", "Location", "EFF-001", "Parameter", "Copper, Total", _
"Calculation Type", "Average Monthly (AMEL)", "Units", "ug/L", "Sampling Date", sday, "Sampling time", stime)
    End If
   If C Is Nothing Then
    Range(ilast).Offset(iOs, (1 - iCol)) = "EFF-001 / Copper, Total / Average Monthly (AMEL) / ug/L NOT found"
    Range(ilast).Offset(iOs, (1 - iCol)).Font.Color = -16383844
      iOs = iOs + 1
    Else:
        C.Activate
        ActiveCell.Offset(iRow - 5, 0) = "=COUNTIF(R[" & (-iRow + 5) & "]C:R[-9]C, "">"" &R[-2]C)+ COUNTIF(R[" & (-iRow + 5) & "]C:R[-9]C, ""<"" &R[-1]C)"
    ActiveCell.Offset(iRow - 7, 0) = 9.4
        With ActiveCell.Resize(Selection.Rows.Count + (iRow - 14), Selection.Columns.Count)
            .FormatConditions.Add Type:=xlCellValue, Operator:=xlEqual, Formula1:="=AND(COUNT(A2)=1,A2=0)"
            .FormatConditions.Add Type:=xlCellValue, Operator:=xlGreater, Formula1:="=" & ActiveCell.Offset(iRow - 7, 0).Address()
            .FormatConditions(2).Interior.ColorIndex = 3
            .FormatConditions.Add Type:=xlCellValue, Operator:=xlLess, Formula1:="=" & ActiveCell.Offset(iRow - 6, 0).Address()
            .FormatConditions(3).Interior.ColorIndex = 6
       End With
    End If
Set C = Nothing
Set C = ActiveCell.PivotTable.GetPivotData("Result", "Location", "EFF-001", "Parameter", "Copper, Total", _
"Calculation Type", "Single", "Qual", "=", "Units", "ug/L", "Sampling Date", sday, "Sampling time", stime)
   If C Is Nothing Then
Set C = ActiveCell.PivotTable.GetPivotData("Result", "Location", "EFF-001", "Parameter", "Copper, Total", _
"Calculation Type", "Single", "Units", "ug/L", "Sampling Date", sday, "Sampling time", stime)
    End If
   If C Is Nothing Then
    Range(ilast).Offset(iOs, (1 - iCol)) = "EFF-001 / Copper, Total / Single / ug/L NOT found"
    Range(ilast).Offset(iOs, (1 - iCol)).Font.Color = -16383844
      iOs = iOs + 1
    Else:
        C.Activate
        ActiveCell.Offset(iRow - 5, 0) = "=COUNTIF(R[" & (-iRow + 5) & "]C:R[-9]C, "">"" &R[-2]C)+ COUNTIF(R[" & (-iRow + 5) & "]C:R[-9]C, ""<"" &R[-1]C)"
    ActiveCell.Offset(iRow - 7, 0) = 16
        With ActiveCell.Resize(Selection.Rows.Count + (iRow - 14), Selection.Columns.Count)
            .FormatConditions.Add Type:=xlCellValue, Operator:=xlEqual, Formula1:="=AND(COUNT(A2)=1,A2=0)"
            .FormatConditions.Add Type:=xlCellValue, Operator:=xlGreater, Formula1:="=" & ActiveCell.Offset(iRow - 7, 0).Address()
            .FormatConditions(2).Interior.ColorIndex = 3
            .FormatConditions.Add Type:=xlCellValue, Operator:=xlLess, Formula1:="=" & ActiveCell.Offset(iRow - 6, 0).Address()
            .FormatConditions(3).Interior.ColorIndex = 6
       End With
    End If
Set C = Nothing
Set C = ActiveCell.PivotTable.GetPivotData("Result", "Location", "EFF-001", "Parameter", "Nickel, Total", _
"Calculation Type", "Average Monthly (AMEL)", "Qual", "=", "Units", "ug/L", "Sampling Date", sday, "Sampling time", stime)
   If C Is Nothing Then
Set C = ActiveCell.PivotTable.GetPivotData("Result", "Location", "EFF-001", "Parameter", "Nickel, Total", _
"Calculation Type", "Average Monthly (AMEL)", "Units", "ug/L", "Sampling Date", sday, "Sampling time", stime)
    End If
   If C Is Nothing Then
    Range(ilast).Offset(iOs, (1 - iCol)) = "EFF-001 / Nickel, Total / Average Monthly (AMEL) / ug/L NOT found"
    Range(ilast).Offset(iOs, (1 - iCol)).Font.Color = -16383844
      iOs = iOs + 1
    Else:
        C.Activate
        ActiveCell.Offset(iRow - 5, 0) = "=COUNTIF(R[" & (-iRow + 5) & "]C:R[-9]C, "">"" &R[-2]C)+ COUNTIF(R[" & (-iRow + 5) & "]C:R[-9]C, ""<"" &R[-1]C)"
    ActiveCell.Offset(iRow - 7, 0) = 7.8
        With ActiveCell.Resize(Selection.Rows.Count + (iRow - 14), Selection.Columns.Count)
            .FormatConditions.Add Type:=xlCellValue, Operator:=xlEqual, Formula1:="=AND(COUNT(A2)=1,A2=0)"
            .FormatConditions.Add Type:=xlCellValue, Operator:=xlGreater, Formula1:="=" & ActiveCell.Offset(iRow - 7, 0).Address()
            .FormatConditions(2).Interior.ColorIndex = 3
            .FormatConditions.Add Type:=xlCellValue, Operator:=xlLess, Formula1:="=" & ActiveCell.Offset(iRow - 6, 0).Address()
            .FormatConditions(3).Interior.ColorIndex = 6
       End With
    End If
Set C = Nothing
Set C = ActiveCell.PivotTable.GetPivotData("Result", "Location", "EFF-001", "Parameter", "Nickel, Total", _
"Calculation Type", "Single", "Qual", "=", "Units", "ug/L", "Sampling Date", sday, "Sampling time", stime)
   If C Is Nothing Then
Set C = ActiveCell.PivotTable.GetPivotData("Result", "Location", "EFF-001", "Parameter", "Nickel, Total", _
"Calculation Type", "Single", "Units", "ug/L", "Sampling Date", sday, "Sampling time", stime)
    End If
   If C Is Nothing Then
    Range(ilast).Offset(iOs, (1 - iCol)) = "EFF-001 / Nickel, Total / Single / ug/L NOT found"
    Range(ilast).Offset(iOs, (1 - iCol)).Font.Color = -16383844
      iOs = iOs + 1
    Else:
        C.Activate
        ActiveCell.Offset(iRow - 5, 0) = "=COUNTIF(R[" & (-iRow + 5) & "]C:R[-9]C, "">"" &R[-2]C)+ COUNTIF(R[" & (-iRow + 5) & "]C:R[-9]C, ""<"" &R[-1]C)"
    ActiveCell.Offset(iRow - 7, 0) = 10
        With ActiveCell.Resize(Selection.Rows.Count + (iRow - 14), Selection.Columns.Count)
            .FormatConditions.Add Type:=xlCellValue, Operator:=xlEqual, Formula1:="=AND(COUNT(A2)=1,A2=0)"
            .FormatConditions.Add Type:=xlCellValue, Operator:=xlGreater, Formula1:="=" & ActiveCell.Offset(iRow - 7, 0).Address()
            .FormatConditions(2).Interior.ColorIndex = 3
            .FormatConditions.Add Type:=xlCellValue, Operator:=xlLess, Formula1:="=" & ActiveCell.Offset(iRow - 6, 0).Address()
            .FormatConditions(3).Interior.ColorIndex = 6
       End With
    End If
Set C = Nothing
Set C = ActiveCell.PivotTable.GetPivotData("Result", "Location", "EFF-001", "Parameter", "Cyanide, Total (as CN)", _
"Calculation Type", "Average Monthly (AMEL)", "Qual", "=", "Units", "ug/L", "Sampling Date", sday, "Sampling time", stime)
   If C Is Nothing Then
Set C = ActiveCell.PivotTable.GetPivotData("Result", "Location", "EFF-001", "Parameter", "Cyanide, Total (as CN)", _
"Calculation Type", "Average Monthly (AMEL)", "Units", "ug/L", "Sampling Date", sday, "Sampling time", stime)
    End If
   If C Is Nothing Then
    Range(ilast).Offset(iOs, (1 - iCol)) = "EFF-001 / Cyanide, Total (as CN) / Average Monthly (AMEL) / ug/L NOT found"
    Range(ilast).Offset(iOs, (1 - iCol)).Font.Color = -16383844
      iOs = iOs + 1
    Else:
        C.Activate
        ActiveCell.Offset(iRow - 5, 0) = "=COUNTIF(R[" & (-iRow + 5) & "]C:R[-9]C, "">"" &R[-2]C)+ COUNTIF(R[" & (-iRow + 5) & "]C:R[-9]C, ""<"" &R[-1]C)"
    ActiveCell.Offset(iRow - 7, 0) = 6.4
        With ActiveCell.Resize(Selection.Rows.Count + (iRow - 14), Selection.Columns.Count)
            .FormatConditions.Add Type:=xlCellValue, Operator:=xlEqual, Formula1:="=AND(COUNT(A2)=1,A2=0)"
            .FormatConditions.Add Type:=xlCellValue, Operator:=xlGreater, Formula1:="=" & ActiveCell.Offset(iRow - 7, 0).Address()
            .FormatConditions(2).Interior.ColorIndex = 3
            .FormatConditions.Add Type:=xlCellValue, Operator:=xlLess, Formula1:="=" & ActiveCell.Offset(iRow - 6, 0).Address()
            .FormatConditions(3).Interior.ColorIndex = 6
       End With
    End If
Set C = Nothing
Set C = ActiveCell.PivotTable.GetPivotData("Result", "Location", "EFF-001", "Parameter", "Cyanide, Total (as CN)", _
"Calculation Type", "Single", "Qual", "=", "Units", "ug/L", "Sampling Date", sday, "Sampling time", stime)
   If C Is Nothing Then
Set C = ActiveCell.PivotTable.GetPivotData("Result", "Location", "EFF-001", "Parameter", "Cyanide, Total (as CN)", _
"Calculation Type", "Single", "Units", "ug/L", "Sampling Date", sday, "Sampling time", stime)
    End If
   If C Is Nothing Then
    Range(ilast).Offset(iOs, (1 - iCol)) = "EFF-001 / Cyanide, Total (as CN) / Single / ug/L NOT found"
    Range(ilast).Offset(iOs, (1 - iCol)).Font.Color = -16383844
      iOs = iOs + 1
    Else:
        C.Activate
        ActiveCell.Offset(iRow - 5, 0) = "=COUNTIF(R[" & (-iRow + 5) & "]C:R[-9]C, "">"" &R[-2]C)+ COUNTIF(R[" & (-iRow + 5) & "]C:R[-9]C, ""<"" &R[-1]C)"
    ActiveCell.Offset(iRow - 7, 0) = 15
        With ActiveCell.Resize(Selection.Rows.Count + (iRow - 14), Selection.Columns.Count)
            .FormatConditions.Add Type:=xlCellValue, Operator:=xlEqual, Formula1:="=AND(COUNT(A2)=1,A2=0)"
            .FormatConditions.Add Type:=xlCellValue, Operator:=xlGreater, Formula1:="=" & ActiveCell.Offset(iRow - 7, 0).Address()
            .FormatConditions(2).Interior.ColorIndex = 3
            .FormatConditions.Add Type:=xlCellValue, Operator:=xlLess, Formula1:="=" & ActiveCell.Offset(iRow - 6, 0).Address()
            .FormatConditions(3).Interior.ColorIndex = 6
       End With
    End If
Set C = Nothing
Set C = ActiveCell.PivotTable.GetPivotData("Result", "Location", "EFF-001", "Parameter", "TCDD Equivalents", _
"Calculation Type", "Average Monthly (AMEL)", "Qual", "=", "Units", "ug/L", "Sampling Date", sday, "Sampling time", stime)
   If C Is Nothing Then
Set C = ActiveCell.PivotTable.GetPivotData("Result", "Location", "EFF-001", "Parameter", "TCDD Equivalents", _
"Calculation Type", "Average Monthly (AMEL)", "Units", "ug/L", "Sampling Date", sday, "Sampling time", stime)
    End If
   If C Is Nothing Then
    Range(ilast).Offset(iOs, (1 - iCol)) = "EFF-001 / TCDD Equivalents / Average Monthly (AMEL) / ug/L NOT found"
    Range(ilast).Offset(iOs, (1 - iCol)).Font.Color = -16383844
      iOs = iOs + 1
    Else:
        C.Activate
        ActiveCell.Offset(iRow - 5, 0) = "=COUNTIF(R[" & (-iRow + 5) & "]C:R[-9]C, "">"" &R[-2]C)+ COUNTIF(R[" & (-iRow + 5) & "]C:R[-9]C, ""<"" &R[-1]C)"
    ActiveCell.Offset(iRow - 7, 0) = 0.000000014
        With ActiveCell.Resize(Selection.Rows.Count + (iRow - 14), Selection.Columns.Count)
            .FormatConditions.Add Type:=xlCellValue, Operator:=xlEqual, Formula1:="=AND(COUNT(A2)=1,A2=0)"
            .FormatConditions.Add Type:=xlCellValue, Operator:=xlGreater, Formula1:="=" & ActiveCell.Offset(iRow - 7, 0).Address()
            .FormatConditions(2).Interior.ColorIndex = 3
            .FormatConditions.Add Type:=xlCellValue, Operator:=xlLess, Formula1:="=" & ActiveCell.Offset(iRow - 6, 0).Address()
            .FormatConditions(3).Interior.ColorIndex = 6
       End With
    End If
Set C = Nothing
Set C = ActiveCell.PivotTable.GetPivotData("Result", "Location", "EFF-001", "Parameter", "TCDD Equivalents", _
"Calculation Type", "Single", "Qual", "=", "Units", "ug/L", "Sampling Date", sday, "Sampling time", stime)
   If C Is Nothing Then
Set C = ActiveCell.PivotTable.GetPivotData("Result", "Location", "EFF-001", "Parameter", "TCDD Equivalents", _
"Calculation Type", "Single", "Units", "ug/L", "Sampling Date", sday, "Sampling time", stime)
    End If
   If C Is Nothing Then
    Range(ilast).Offset(iOs, (1 - iCol)) = "EFF-001 / TCDD Equivalents / Single / ug/L NOT found"
    Range(ilast).Offset(iOs, (1 - iCol)).Font.Color = -16383844
      iOs = iOs + 1
    Else:
        C.Activate
        ActiveCell.Offset(iRow - 5, 0) = "=COUNTIF(R[" & (-iRow + 5) & "]C:R[-9]C, "">"" &R[-2]C)+ COUNTIF(R[" & (-iRow + 5) & "]C:R[-9]C, ""<"" &R[-1]C)"
    ActiveCell.Offset(iRow - 7, 0) = 0.000000028
        With ActiveCell.Resize(Selection.Rows.Count + (iRow - 14), Selection.Columns.Count)
            .FormatConditions.Add Type:=xlCellValue, Operator:=xlEqual, Formula1:="=AND(COUNT(A2)=1,A2=0)"
            .FormatConditions.Add Type:=xlCellValue, Operator:=xlGreater, Formula1:="=" & ActiveCell.Offset(iRow - 7, 0).Address()
            .FormatConditions(2).Interior.ColorIndex = 3
            .FormatConditions.Add Type:=xlCellValue, Operator:=xlLess, Formula1:="=" & ActiveCell.Offset(iRow - 6, 0).Address()
            .FormatConditions(3).Interior.ColorIndex = 6
       End With
    End If
Set C = Nothing
Set C = ActiveCell.PivotTable.GetPivotData("Result", "Location", "EFF-001", "Parameter", "Ammonia, Total (as N)", _
"Calculation Type", "Average Monthly (AMEL)", "Qual", "=", "Units", "mg/L", "Sampling Date", sday, "Sampling time", stime)
   If C Is Nothing Then
Set C = ActiveCell.PivotTable.GetPivotData("Result", "Location", "EFF-001", "Parameter", "Ammonia, Total (as N)", _
"Calculation Type", "Average Monthly (AMEL)", "Units", "mg/L", "Sampling Date", sday, "Sampling time", stime)
    End If
   If C Is Nothing Then
    Range(ilast).Offset(iOs, (1 - iCol)) = "EFF-001 / Ammonia, Total (as N) / Average Monthly (AMEL) / mg/L NOT found"
    Range(ilast).Offset(iOs, (1 - iCol)).Font.Color = -16383844
      iOs = iOs + 1
    Else:
        C.Activate
        ActiveCell.Offset(iRow - 5, 0) = "=COUNTIF(R[" & (-iRow + 5) & "]C:R[-9]C, "">"" &R[-2]C)+ COUNTIF(R[" & (-iRow + 5) & "]C:R[-9]C, ""<"" &R[-1]C)"
    ActiveCell.Offset(iRow - 7, 0) = 21
        With ActiveCell.Resize(Selection.Rows.Count + (iRow - 14), Selection.Columns.Count)
            .FormatConditions.Add Type:=xlCellValue, Operator:=xlEqual, Formula1:="=AND(COUNT(A2)=1,A2=0)"
            .FormatConditions.Add Type:=xlCellValue, Operator:=xlGreater, Formula1:="=" & ActiveCell.Offset(iRow - 7, 0).Address()
            .FormatConditions(2).Interior.ColorIndex = 3
            .FormatConditions.Add Type:=xlCellValue, Operator:=xlLess, Formula1:="=" & ActiveCell.Offset(iRow - 6, 0).Address()
            .FormatConditions(3).Interior.ColorIndex = 6
       End With
    End If
Set C = Nothing
Set C = ActiveCell.PivotTable.GetPivotData("Result", "Location", "EFF-001", "Parameter", "Ammonia, Total (as N)", _
"Calculation Type", "Single", "Qual", "=", "Units", "mg/L", "Sampling Date", sday, "Sampling time", stime)
   If C Is Nothing Then
Set C = ActiveCell.PivotTable.GetPivotData("Result", "Location", "EFF-001", "Parameter", "Ammonia, Total (as N)", _
"Calculation Type", "Single", "Units", "mg/L", "Sampling Date", sday, "Sampling time", stime)
    End If
   If C Is Nothing Then
    Range(ilast).Offset(iOs, (1 - iCol)) = "EFF-001 / Ammonia, Total (as N) / Single / mg/L NOT found"
    Range(ilast).Offset(iOs, (1 - iCol)).Font.Color = -16383844
      iOs = iOs + 1
    Else:
        C.Activate
        ActiveCell.Offset(iRow - 5, 0) = "=COUNTIF(R[" & (-iRow + 5) & "]C:R[-9]C, "">"" &R[-2]C)+ COUNTIF(R[" & (-iRow + 5) & "]C:R[-9]C, ""<"" &R[-1]C)"
    ActiveCell.Offset(iRow - 7, 0) = 49
        With ActiveCell.Resize(Selection.Rows.Count + (iRow - 14), Selection.Columns.Count)
            .FormatConditions.Add Type:=xlCellValue, Operator:=xlEqual, Formula1:="=AND(COUNT(A2)=1,A2=0)"
            .FormatConditions.Add Type:=xlCellValue, Operator:=xlGreater, Formula1:="=" & ActiveCell.Offset(iRow - 7, 0).Address()
            .FormatConditions(2).Interior.ColorIndex = 3
            .FormatConditions.Add Type:=xlCellValue, Operator:=xlLess, Formula1:="=" & ActiveCell.Offset(iRow - 6, 0).Address()
            .FormatConditions(3).Interior.ColorIndex = 6
       End With
    End If
Set C = Nothing
Set C = ActiveCell.PivotTable.GetPivotData("Result", "Location", "EFF-001", "Parameter", "Acute Toxicity", _
"Calculation Type", "11-Sample Median", "Qual", "=", "Units", "% survival", "Sampling Date", sday, "Sampling time", stime)
   If C Is Nothing Then
Set C = ActiveCell.PivotTable.GetPivotData("Result", "Location", "EFF-001", "Parameter", "Acute Toxicity", _
"Calculation Type", "11-Sample Median", "Units", "% survival", "Sampling Date", sday, "Sampling time", stime)
    End If
   If C Is Nothing Then
    Range(ilast).Offset(iOs, (1 - iCol)) = "EFF-001 / Acute Toxicity / 11-Sample Median / % survival NOT found"
    Range(ilast).Offset(iOs, (1 - iCol)).Font.Color = -16383844
      iOs = iOs + 1
    Else:
        C.Activate
        ActiveCell.Offset(iRow - 5, 0) = "=COUNTIF(R[" & (-iRow + 5) & "]C:R[-9]C, "">"" &R[-2]C)+ COUNTIF(R[" & (-iRow + 5) & "]C:R[-9]C, ""<"" &R[-1]C)"
    ActiveCell.Offset(iRow - 6, 0) = 90
        With ActiveCell.Resize(Selection.Rows.Count + (iRow - 14), Selection.Columns.Count)
            .FormatConditions.Add Type:=xlCellValue, Operator:=xlEqual, Formula1:="=AND(COUNT(A2)=1,A2=0)"
            .FormatConditions.Add Type:=xlCellValue, Operator:=xlGreater, Formula1:="=" & ActiveCell.Offset(iRow - 7, 0).Address()
            .FormatConditions(2).Interior.ColorIndex = 3
            .FormatConditions.Add Type:=xlCellValue, Operator:=xlLess, Formula1:="=" & ActiveCell.Offset(iRow - 6, 0).Address()
            .FormatConditions(3).Interior.ColorIndex = 6
       End With
    End If
Set C = Nothing
Set C = ActiveCell.PivotTable.GetPivotData("Result", "Location", "EFF-001", "Parameter", "Acute Toxicity", _
"Calculation Type", "11 Sample 90th Percentile", "Qual", "=", "Units", "% survival", "Sampling Date", sday, "Sampling time", stime)
   If C Is Nothing Then
Set C = ActiveCell.PivotTable.GetPivotData("Result", "Location", "EFF-001", "Parameter", "Acute Toxicity", _
"Calculation Type", "11 Sample 90th Percentile", "Units", "% survival", "Sampling Date", sday, "Sampling time", stime)
    End If
   If C Is Nothing Then
    Range(ilast).Offset(iOs, (1 - iCol)) = "EFF-001 / Acute Toxicity / 11 Sample 90th Percentile / % survival NOT found"
    Range(ilast).Offset(iOs, (1 - iCol)).Font.Color = -16383844
      iOs = iOs + 1
    Else:
        C.Activate
        ActiveCell.Offset(iRow - 5, 0) = "=COUNTIF(R[" & (-iRow + 5) & "]C:R[-9]C, "">"" &R[-2]C)+ COUNTIF(R[" & (-iRow + 5) & "]C:R[-9]C, ""<"" &R[-1]C)"
    ActiveCell.Offset(iRow - 6, 0) = 70
        With ActiveCell.Resize(Selection.Rows.Count + (iRow - 14), Selection.Columns.Count)
            .FormatConditions.Add Type:=xlCellValue, Operator:=xlEqual, Formula1:="=AND(COUNT(A2)=1,A2=0)"
            .FormatConditions.Add Type:=xlCellValue, Operator:=xlGreater, Formula1:="=" & ActiveCell.Offset(iRow - 7, 0).Address()
            .FormatConditions(2).Interior.ColorIndex = 3
            .FormatConditions.Add Type:=xlCellValue, Operator:=xlLess, Formula1:="=" & ActiveCell.Offset(iRow - 6, 0).Address()
            .FormatConditions(3).Interior.ColorIndex = 6
       End With
    End If
Set C = Nothing
  
End Sub

Sub Grp2(ilast, iCol, iRow, iOs, sday, stime)
On Error Resume Next
End Sub

I just want to remove that from popping up anymore upon opening or closing Excel. I can no longer run any other add-ins as well once this started. Can anybody help?

Thank you.
 
Last edited by a moderator:

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).

Forum statistics

Threads
1,222,195
Messages
6,164,513
Members
451,900
Latest member
lamski

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top