|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
Sub aa()
Dim i%, sr1$, sr2$, x As Single
With ActiveDocument.Tables(1)
For i = 2 To .Rows.Count - 1
sr1 = .Cell(i, 2).Range.Text
.Cell(i, 2).Select
' sr2 = .Cell(i, 4).Range.Text
'Like 匹配的关键字前后都要有*号,不然“保洁不到位”后面有字符,就匹配不了
If sr1 Like "*保洁不到位*" Or sr1 Like "*零星垃圾*" Then
sr2 = "-0.5分"
.Cell(i, 4).Range.Text = sr2 '赋值
ElseIf sr1 Like "*卫生差*" Or sr1 Like "*乱搭盖*" Or sr1 Like "*乱张贴*" Or sr1 Like "*乱拉挂*" Then
sr2 = "-1分"
.Cell(i, 4).Range.Text = sr2 '赋值
ElseIf sr1 Like "*垃圾堆积*" Or sr1 Like "*建筑垃圾*" Then
sr2 = "-2分"
.Cell(i, 4).Range.Text = sr2 '赋值
ElseIf sr1 Like "*陈年垃圾*" Or sr1 Like "*卫生死角*" Or sr1 Like "*焚烧垃圾*" Then
sr2 = "-3分"
.Cell(i, 4).Range.Text = sr2 '赋值
End If
x = x + Val(sr2) '累积扣分
Next i
.Cell(.Rows.Count, 4).Range.Text = 100 + x & "分"
End With
End Sub |
评分
-
1
查看全部评分
-
|