Function lastRow(x As Range) As Integer
Dim r%, i%
lastRow = -1 '表示找不到
r = ActiveSheet.UsedRange.Rows.Count
For i = x To r
If Cells(i, 1) < 0 Then lastRow = i: Exit For
Next i
End Function
Sub test()
Dim i, maxrow, s
maxrow = Cells(Rows.Count, 1).End(xlUp).Row
s =val( InputBox("请输入开始行号"))
For i = s To maxrow
If Cells(i, 1) < 0 Then
MsgBox "第" & s & "行开始,第一个负数所在行为第" & i & "行"
Exit For
End If
Next
End Sub
Function lastRow(x As Range) As Integer
Dim r%, i%
lastRow = -1 '表示找不到
r = ActiveSheet.UsedRange.Rows.Count
For i = x To r
If Cells(i, 1) < 0 Then lastRow = i: Exit For
Next i
End Function