Sub 案例12() '确认A1区域行数 a1 = [a1].CurrentRegion.Rows.Count For I = 2 To a1 Debug.Print Cells(I, 1).Value If Cells(I, 1).Value = [H2].Value Then Debug.Print "品名相等" If Cells(I, 5).Value < [J2].Value Then [K2].Value = Cells(I, 3).Value End If End If Next I End Sub