|
外面再套一层循环即可
Sub dd()
Dim sht As Worksheet
Range("E2:G1000").Clear
k = 2
For Each sht In Worksheets
If sht.Name <> "筛选页面" Then
shtrows = sht.Cells(Rows.Count, 1).End(xlUp).Row
For i = 3 To shtrows
If sht.Cells(i, 4) - Cells(4, 3) < 10 And sht.Cells(i, 4) - Cells(4, 3) > -10 Then
If sht.Cells(i, 2) = Cells(2, 3) And sht.Cells(i, 3) = Cells(3, 3) And sht.Cells(i, 6) = Cells(6, 3) Then
Cells(k, 5) = sht.Cells(i, 1)
Cells(k, 6) = sht.Cells(i, 8)
Cells(k, 7) = sht.Cells(i, 4)
k = k + 1
End If
End If
Next
End If
Next
For j = 2 To Cells(Rows.Count, 7).End(xlUp).Row
If Cells(j, 7) = Cells(4, 3) Then
Range(Cells(j, 5), Cells(j, 7)).Interior.Color = VBA.vbYellow
End If
Next
End Sub |
|