编译错误 - 以。结尾

时间:2017-03-16 17:31:17

标签: excel excel-vba compilation vba

所以使用这段代码我不断得到一个编译错误结束 - 我怎么能解决这个问题?这适用于我的所有其他文件,但不适用于此文件。这基本上是一个笑脸图标,并根据它所看到的细胞将颜色更新为红色或绿色。

    Sub UpdateSmileys()

    'CUSTOMER COMPLAINTS


    If Sheets("Data").Range("T2").Value >= Sheets("Data").Range("T3").Value Then
      Sheets("KPIs").Select
      ActiveSheet.Shapes.Range(Array("Smiley Face 133")).Select
    With Selection.ShapeRange.Fill
        .Visible = msoTrue
        .ForeColor.RGB = RGB(146, 208, 80)
        .Transparency = 0
        .Solid
    End With
    Selection.ShapeRange.Adjustments.Item(1) = 0.04653
   Else
    ActiveSheet.Shapes.Range(Array("Smiley Face 133")).Select
    With Selection.ShapeRange.Fill
        .Visible = msoTrue
        .ForeColor.RGB = RGB(255, 0, 0)
        .Transparency = 0
        .Solid


    'INTERNAL PPM

    If Sheets("Data").Range("T4").Value >= Sheets("Data").Range("T5").Value Then
      Sheets("KPIs").Select
      ActiveSheet.Shapes.Range(Array("Smiley Face 170")).Select
    With Selection.ShapeRange.Fill
        .Visible = msoTrue
        .ForeColor.RGB = RGB(146, 208, 80)
        .Transparency = 0
        .Solid
    End With
    Selection.ShapeRange.Adjustments.Item(1) = 0.04653
   Else
    ActiveSheet.Shapes.Range(Array("Smiley Face 170")).Select
    With Selection.ShapeRange.Fill
        .Visible = msoTrue
        .ForeColor.RGB = RGB(255, 0, 0)
        .Transparency = 0
        .Solid


    'EXTERNAL PPM

    If Sheets("Data").Range("T6").Value >= Sheets("Data").Range("T7").Value Then
      Sheets("KPIs").Select
      ActiveSheet.Shapes.Range(Array("Smiley Face 120")).Select
    With Selection.ShapeRange.Fill
        .Visible = msoTrue
        .ForeColor.RGB = RGB(146, 208, 80)
        .Transparency = 0
        .Solid
    End With
    Selection.ShapeRange.Adjustments.Item(1) = 0.04653
   Else
    ActiveSheet.Shapes.Range(Array("Smiley Face 120")).Select
    With Selection.ShapeRange.Fill
        .Visible = msoTrue
        .ForeColor.RGB = RGB(255, 0, 0)
        .Transparency = 0
        .Solid


  '8D OPEN/CLOSED BY CUSTOMER

   If Sheets("Data").Range("T8").Value >= Sheets("Data").Range("T9").Value Then
      Sheets("KPIs").Select
      ActiveSheet.Shapes.Range(Array("Smiley Face 116")).Select
    With Selection.ShapeRange.Fill
        .Visible = msoTrue
        .ForeColor.RGB = RGB(146, 208, 80)
        .Transparency = 0
        .Solid
    End With
    Selection.ShapeRange.Adjustments.Item(1) = 0.04653
   Else
    ActiveSheet.Shapes.Range(Array("Smiley Face 116")).Select
    With Selection.ShapeRange.Fill
        .Visible = msoTrue
        .ForeColor.RGB = RGB(255, 0, 0)
        .Transparency = 0
        .Solid




    'SUPPLIER QUALITY DISRUPTIONS

   If Sheets("Data").Range("T10").Value >= Sheets("Data").Range("T11").Value Then
      Sheets("KPIs").Select
      ActiveSheet.Shapes.Range(Array("Smiley Face 127")).Select
    With Selection.ShapeRange.Fill
        .Visible = msoTrue
        .ForeColor.RGB = RGB(146, 208, 80)
        .Transparency = 0
        .Solid
    End With
    Selection.ShapeRange.Adjustments.Item(1) = 0.04653
   Else
    ActiveSheet.Shapes.Range(Array("Smiley Face 127")).Select
    With Selection.ShapeRange.Fill
        .Visible = msoTrue
        .ForeColor.RGB = RGB(255, 0, 0)
        .Transparency = 0
        .Solid


    'TOTAL QUALITY COSTS

   If Sheets("Data").Range("T12").Value >= Sheets("Data").Range("T13").Value Then
      Sheets("KPIs").Select
      ActiveSheet.Shapes.Range(Array("Smiley Face 157")).Select
    With Selection.ShapeRange.Fill
        .Visible = msoTrue
        .ForeColor.RGB = RGB(146, 208, 80)
        .Transparency = 0
        .Solid
    End With
    Selection.ShapeRange.Adjustments.Item(1) = 0.04653
   Else
    ActiveSheet.Shapes.Range(Array("Smiley Face 157")).Select
    With Selection.ShapeRange.Fill
        .Visible = msoTrue
        .ForeColor.RGB = RGB(255, 0, 0)
        .Transparency = 0
        .Solid




    'WARRANTY RETURNS

   If Sheets("Data").Range("T14").Value <= Sheets("Data").Range("T15").Value Then
      Sheets("KPIs").Select
      ActiveSheet.Shapes.Range(Array("Smiley Face 117")).Select
    With Selection.ShapeRange.Fill
        .Visible = msoTrue
        .ForeColor.RGB = RGB(146, 208, 80)
        .Transparency = 0
        .Solid
    End With
    Selection.ShapeRange.Adjustments.Item(1) = 0.04653
   Else
    ActiveSheet.Shapes.Range(Array("Smiley Face 117")).Select
    With Selection.ShapeRange.Fill
        .Visible = msoTrue
        .ForeColor.RGB = RGB(255, 0, 0)
        .Transparency = 0
        .Solid

    'DEPARTMENT TRAINING

   If Sheets("Data").Range("T16").Value >= Sheets("Data").Range("T17").Value Then
      Sheets("KPIs").Select
      ActiveSheet.Shapes.Range(Array("Smiley Face 128")).Select
    With Selection.ShapeRange.Fill
        .Visible = msoTrue
        .ForeColor.RGB = RGB(146, 208, 80)
        .Transparency = 0
        .Solid
    End With
    Selection.ShapeRange.Adjustments.Item(1) = 0.04653
   Else
    ActiveSheet.Shapes.Range(Array("Smiley Face 128")).Select
    With Selection.ShapeRange.Fill
        .Visible = msoTrue
        .ForeColor.RGB = RGB(255, 0, 0)
        .Transparency = 0
        .Solid

    'LP AUDITS

   If Sheets("Data").Range("T3").Value >= Sheets("Data").Range("T4").Value Then
      Sheets("KPIs").Select
      ActiveSheet.Shapes.Range(Array("Smiley Face 131")).Select
    With Selection.ShapeRange.Fill
        .Visible = msoTrue
        .ForeColor.RGB = RGB(146, 208, 80)
        .Transparency = 0
        .Solid
    End With
    Selection.ShapeRange.Adjustments.Item(1) = 0.04653
   Else
    ActiveSheet.Shapes.Range(Array("Smiley Face 131")).Select
    With Selection.ShapeRange.Fill
        .Visible = msoTrue
        .ForeColor.RGB = RGB(255, 0, 0)
        .Transparency = 0
        .Solid



    'SUPPLIER QUALITY AUDITS

   If Sheets("Data").Range("T24").Value >= Sheets("Data").Range("T25").Value Then
      Sheets("KPIs").Select
      ActiveSheet.Shapes.Range(Array("Smiley Face 125")).Select
    With Selection.ShapeRange.Fill
        .Visible = msoTrue
        .ForeColor.RGB = RGB(146, 208, 80)
        .Transparency = 0
        .Solid
    End With
    Selection.ShapeRange.Adjustments.Item(1) = 0.04653
   Else
    ActiveSheet.Shapes.Range(Array("Smiley Face 125")).Select
    With Selection.ShapeRange.Fill
        .Visible = msoTrue
        .ForeColor.RGB = RGB(255, 0, 0)
        .Transparency = 0
        .Solid


    'EMPLOYEE MORALE

   If Sheets("Data").Range("T26").Value >= Sheets("Data").Range("T27").Value Then
      Sheets("KPIs").Select
      ActiveSheet.Shapes.Range(Array("Smiley Face 129")).Select
    With Selection.ShapeRange.Fill
        .Visible = msoTrue
        .ForeColor.RGB = RGB(146, 208, 80)
        .Transparency = 0
        .Solid
    End With
    Selection.ShapeRange.Adjustments.Item(1) = 0.04653
   Else
    ActiveSheet.Shapes.Range(Array("Smiley Face 129")).Select
    With Selection.ShapeRange.Fill
        .Visible = msoTrue
        .ForeColor.RGB = RGB(255, 0, 0)
        .Transparency = 0
        .Solid

    'INTERNAL 8D COMPLETED

   If Sheets("Data").Range("T18").Value >= Sheets("Data").Range("T19").Value Then
      Sheets("KPIs").Select
      ActiveSheet.Shapes.Range(Array("Smiley Face 158")).Select
    With Selection.ShapeRange.Fill
        .Visible = msoTrue
        .ForeColor.RGB = RGB(146, 208, 80)
        .Transparency = 0
        .Solid
    End With
    Selection.ShapeRange.Adjustments.Item(1) = 0.04653
   Else
    ActiveSheet.Shapes.Range(Array("Smiley Face 158")).Select
    With Selection.ShapeRange.Fill
        .Visible = msoTrue
        .ForeColor.RGB = RGB(255, 0, 0)
        .Transparency = 0
        .Solid

    'INTERNAL DEPARTMENT AUDITS


   If Sheets("Data").Range("T20").Value >= Sheets("Data").Range("T21").Value Then
      Sheets("KPIs").Select
      ActiveSheet.Shapes.Range(Array("Smiley Face 118")).Select
    With Selection.ShapeRange.Fill
        .Visible = msoTrue
        .ForeColor.RGB = RGB(146, 208, 80)
        .Transparency = 0
        .Solid
    End With
    Selection.ShapeRange.Adjustments.Item(1) = 0.04653
   Else
    ActiveSheet.Shapes.Range(Array("Smiley Face 118")).Select
    With Selection.ShapeRange.Fill
        .Visible = msoTrue
        .ForeColor.RGB = RGB(255, 0, 0)
        .Transparency = 0
        .Solid




    End Sub

0 个答案:

没有答案