|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
- Sub test()
- Dim iRow01&, iRow02&, cel As Range, Rng As Range, Findaddress
- iRow01 = Sheet1.Range("A" & Sheet1.Rows.Count).End(3).Row
- iRow02 = Sheet2.Range("A" & Sheet2.Rows.Count).End(3).Row
- For Each cel In Sheet1.Range("A2:A" & iRow01)
- Set Rng = Sheet2.Range("A2:A" & iRow02).Find(cel.Text)
- If Not Rng Is Nothing Then
- Findaddress = Rng.Address
- Do
- If Rng.Offset(0, 1).Text = cel.Offset(0, 1).Text And Rng.Offset(0, 2).Text = cel.Offset(0, 2).Text And Rng.Offset(0, 3).Text = cel.Offset(0, 3).Text Then
- Rng.EntireRow.Interior.Color = 65535
- End If
- Set Rng = Sheet2.Range("A2:A" & iRow02).FindNext(Rng)
- Loop While Not Rng Is Nothing And Rng.Address <> Findaddress
- End If
- Next
- End Sub
复制代码 |
|