```
Function Firsttext2(ParamArray Inputrange() As Variant) As Variant
Firsttext2 = WFIFindNonblank("First", "Text", Inputrange())
End Function
Public Function FindNonblank(order As String, _
range_type As String, _
ParamArray Inputrange() As Variant) _
As Variant
Dim i, z, k, range_count, row_count, col_count As Integer
Dim end_row, begin_row, end_column, begin_column, begin_val, end_val, step As Integer
Dim Rng As range
WFIFindNonblank = "something wrong"
'WFIFindNonblank = CVErr(xlErrNA)
range_count = UBound(Inputrange)
If order = "Last" Then
end_val = range_count
begin_val = 0
step = -1
Else
end_val = 0
begin_val = range_count
step = 1
End If
For z = end_val To begin_val Step step
Set Rng = Inputrange(z)
row_count = Rng.Rows.Count
col_count = Rng.Columns.Count
Select Case order
Case "Last"
end_row = row_count
begin_row = 1
end_column = col_count
begin_column = 1
Case "First"
end_row = 1
begin_row = row_count
end_column = 1
begin_column = col_count
End Select
For i = end_row To begin_row Step step
For k = end_column To begin_column Step step
If IsNumeric(Rng(i, k)) And Not IsEmpty(Rng(i, k)) And range_type = "Number" Then
FindNonblank = Rng(i, k)
Exit Function
Else
If TypeName(Rng(i, k).Value) = "String" And range_type = "Text" Then
FindNonblank = Rng(i, k)
Exit Function
End If
End If
Next k
Next i
Next z
End Function
```