|
楼主 |
发表于 2024-6-29 18:09
|
显示全部楼层
Sub shu()
Dim r%, i%
Sheets("sheet1").Range("h1:j2") = ""
r = Sheets("sheet2").Cells(Sheets("sheet2").Rows.Count, 3).End(xlUp).Row
For i = 2 To r
If Sheets("一分一段表").Cells(i, 3) - Sheets("sheet1").Range("e1") = 0 Then
Sheets("sheet1").Range("h1") = Sheets("sheet2").Cells(i, 1)
Sheets("sheet1").Range("i1") = Sheets("sheet2").Cells(i, 2)
Sheets("sheet1").Range("j1") = Sheets("sheet2").Cells(i, 3)
Sheets("sheet1").Range("h2") = Sheets("sheet2").Cells(i - 1, 1)
Sheets("sheet1").Range("i2") = Sheets("sheet2").Cells(i - 1, 2)
Sheets("sheet1").Range("j2") = Sheets("sheet2").Cells(i - 1, 3)
Exit For
End If
Next
End Sub |
|