|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
Sub 按钮1_Click()
Application.ScreenUpdating = False
Range("b10:i20").ClearContents
Set Rng = Columns("m").Find(Cells(2, 1), lookat:=xlWhole, SearchDirection:=xlPrevious)
If Rng Is Nothing Then MsgBox [a2] & ":该值在M列不存在": GoTo l1
ru = Rng.Row
Set Rng = Columns("m").Find(Cells(2, 1), lookat:=xlWhole, SearchDirection:=xlNext)
rd = Rng.Row
arr = Range("a10:i20")
Set rng1 = Range("n" & rd & ":n" & ru)
For j = 1 To UBound(arr)
If Not rng1.Find(arr(j, 1), lookat:=xlWhole) Is Nothing Then
r = rng1.Find(arr(j, 1), lookat:=xlWhole).Row
For i = 2 To 9
If InStr("丙辛", Cells(1, i)) > 0 Then
arr(j, i) = IIf(Cells(r, 14 + InStr("甲乙丙丁戊己庚辛", Cells(1, i))) >= Cells(2, i), 0, 1)
Else
arr(j, i) = IIf(Cells(r, 14 + InStr("甲乙丙丁戊己庚辛", Cells(1, i))) > Cells(2, i), 1, 0)
End If
Next i
End If
Next j
Range("a10:i20") = arr
l1:
Application.ScreenUpdating = True
End Sub |
评分
-
1
查看全部评分
-
|