Function FINDLR(table, row, line)
'FINDLR = Application.WorksheetFunction.VLookup(name, Sheets(table).Range("A:ZZ"), line, 0)
'表格范围:行最大值MAXROW 列最大值MAXLINE
Dim MAXROW, MAXLINE As Long
MAXROW = 1000
MAXLINE = 255
'获取对应table中第一个不为空的行列 i:行 j:列
Dim i, j As Long
For i = 1 To 1000
If Sheets(table).Cells(i, 1).Value <> "" Then
For j = 1 To 255
If Sheets(table).Cells(i, j).Value <> "" Then
Exit For
End If
Next
Exit For
End If
Next
Dim i2, j2 As Long
Dim find As Boolean
find = False
'先确定行中是否存在row
For i2 = i To 1000
If Sheets(table).Cells(i2, j).Value = row Then
'存在row,再取line
For j2 = j To 1000
If Sheets(table).Cells(i, j2).Value = line Then
find = True
Exit For
End If
Next
Exit For
End If
Next
If find = True Then
FINDLR = Sheets(table).Cells(i2, j2)
Else
FINDLR = ""
End If
'FINDLR = Application.WorksheetFunction.VLookup(name, Sheets(table).Range("A:ZZ"), line, 0)
'表格范围:行最大值MAXROW 列最大值MAXLINE
Dim MAXROW, MAXLINE As Long
MAXROW = 1000
MAXLINE = 255
'获取对应table中第一个不为空的行列 i:行 j:列
Dim i, j As Long
For i = 1 To 1000
If Sheets(table).Cells(i, 1).Value <> "" Then
For j = 1 To 255
If Sheets(table).Cells(i, j).Value <> "" Then
Exit For
End If
Next
Exit For
End If
Next
Dim i2, j2 As Long
Dim find As Boolean
find = False
'先确定行中是否存在row
For i2 = i To 1000
If Sheets(table).Cells(i2, j).Value = row Then
'存在row,再取line
For j2 = j To 1000
If Sheets(table).Cells(i, j2).Value = line Then
find = True
Exit For
End If
Next
Exit For
End If
Next
If find = True Then
FINDLR = Sheets(table).Cells(i2, j2)
Else
FINDLR = ""
End If