|
- Dim lastRow As Long
- Dim i As Long
- Private Sub CommandButton1_Click()
- lastRow = Cells(Rows.Count, 2).End(xlUp).Row
- For i = 2 To lastRow
- Cells(i, 6).ClearContents
- Cells(i, 6).Interior.ColorIndex = xlNone
- Next i
- End Sub
- Private Sub CommandButton2_Click()
-
- lastRow = Cells(Rows.Count, 2).End(xlUp).Row
-
- For i = 2 To lastRow
- If Left(Cells(i, 2).Value, 3) = "LHD" Then
- If Cells(i, 8).Value = "-" Then
- If Cells(i, 10).Value = "-" Then
- Cells(i, 6).Interior.Color = RGB(255, 192, 203) ' 浅粉色
- Cells(i, 6).Value = "浅粉色"
- Else
- Cells(i, 6).Interior.Color = RGB(255, 255, 255) ' 白色
- Cells(i, 6).Value = "白色"
- End If
- Else
- If Cells(i, 10).Value = "-" Then
- Cells(i, 6).Interior.Color = RGB(144, 238, 144) ' 浅绿色
- Cells(i, 6).Value = "浅绿色"
- Else
- Cells(i, 6).Interior.Color = RGB(128, 0, 128) ' 紫色
- Cells(i, 6).Value = "紫色"
- End If
- End If
- ElseIf Left(Cells(i, 2).Value, 3) = "RHD" Then
- If Cells(i, 8).Value = "-" Then
- If Cells(i, 10).Value = "-" Then
- Cells(i, 6).Interior.Color = RGB(255, 255, 0) ' 黄色
- Cells(i, 6).Value = "黄色"
- Else
- Cells(i, 6).Interior.Color = RGB(255, 20, 147) ' 深粉色
- Cells(i, 6).Value = "深粉色"
- End If
- Else
- If Cells(i, 10).Value = "-" Then
- Cells(i, 6).Interior.Color = RGB(0, 0, 255) ' 蓝色
- Cells(i, 6).Value = "蓝色"
- Else
- Cells(i, 6).Interior.Color = RGB(0, 100, 0) ' 深绿色
- Cells(i, 6).Value = "深绿色"
- End If
- End If
- ElseIf Cells(i, 3).Value = "825D9-38820" Then
- Cells(i, 6).Interior.Color = RGB(255, 0, 0) ' 红色
- Cells(i, 6).Value = "红色"
- Else
- Cells(i, 6).Interior.ColorIndex = xlNone
- Cells(i, 6).Value = ""
- End If
- Next i
- End Sub
复制代码
|
评分
-
1
查看全部评分
-
|