Files
004_comission/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/GetLastRow.bas
louiscklaw ce9a4aa9b3 update,
2025-01-31 19:27:58 +08:00

70 lines
1.4 KiB
QBasic

Attribute VB_Name = "GetLastRow"
Function run(start_row As Integer)
On Error GoTo eh
Dim last_row As Boolean
Dim last_check_row As Integer
last_check_row = 9999
Dim scan_row As Integer
scan_row = start_row
Dim next_row_1 As Integer
Dim next_row_2 As Integer
Dim next_row_3 As Integer
Dim next_row_4 As Integer
Dim next_row_5 As Integer
For i = start_row To last_check_row
scan_row = i
last_row = True
next_row_1 = i + 1
next_row_2 = i + 2
next_row_3 = i + 3
next_row_4 = i + 4
next_row_5 = i + 5
cell_value_1 = ReadCellValue.run("A" & CStr(next_row_1))
cell_value_2 = ReadCellValue.run("A" & CStr(next_row_2))
cell_value_3 = ReadCellValue.run("A" & CStr(next_row_3))
cell_value_4 = ReadCellValue.run("A" & CStr(next_row_4))
cell_value_5 = ReadCellValue.run("A" & CStr(next_row_5))
If (cell_value_1 <> "") Then
last_row = False
ElseIf (cell_value_2 <> "") Then
last_row = False
ElseIf (cell_value_3 <> "") Then
last_row = False
ElseIf (cell_value_4 <> "") Then
last_row = False
ElseIf (cell_value_5 <> "") Then
last_row = False
Else
Debug.Print "done ?"
End If
If (last_row = True) Then
Debug.Print "last row found"
Exit For
End If
Next i
run = scan_row
Done:
Exit Function
eh:
Debug.Print "WriteStatus"
Debug.Print content
End Function