5.5.10-代码解析:sub_地毯图生成

本过程根据是否超差对测点数据进行底色标记,超差则标红

代码如下

1   Sub sub_地毯图生成(sht)
2       For i = 13 To 15 Step 1
3           pointName = sht.Cells(i, "A")
4           If pointName <> "" Then
5               upTol = sht.Cells(i, "C")
6               downTol = sht.Cells(i, "B")
7               
8               For j = 4 To 8 Step 1
9                   devValue = sht.Cells(i, j)
10                  If devValue > upTol Or devValue < downTol Then
11                       With sht.Cells(i, j).Interior
12                          .Pattern = xlSolid
13                          .PatternColorIndex = xlAutomatic
14                          .Color = 255
15                          .TintAndShade = 0
16                          .PatternTintAndShade = 0
17                      End With
18                  End If
19              Next j
20          Else
21              Exit For
22          End If
23      Next
24  End Sub