S
StFuji
I hate doing dim stuff for arrays:
Hence this function:
declare an array of what not:
dim myArray() as string
addtoarray myArray, "Some String"
* The isBlank function is far from perfect as is the addtoarray
function...I just find these useful
------------------------------------------------------------------------------------------------------------------------------
Public Function AddToArray(ByRef iArray As Variant, ByVal iVal As
Variant) As Variant
On Error GoTo ExitErr
BackIn:
ub = UBound(iArray)
If Not IsBlank(iArray(ub)) Then
ub = ub + 1
ReDim Preserve iArray(ub)
End If
iArray(ub) = iVal
ExitIt:
' Clean Up
Exit Function
ExitErr:
' Process Error
t = Err.Number
u = Err.Description
If Err.Number = 9 Then
ReDim iArray(0)
GoTo BackIn:
End If
GoTo ExitIt
End Function
Public Function IsBlank(ByVal expression As Variant) As Boolean
On Error GoTo ErrRt
IsBlank = False
If IsEmpty(expression) Then
IsBlank = True
ElseIf IsNull(expression) Then
IsBlank = True
ElseIf CStr(expression) = "" Then
IsBlank = True
End If
On Error GoTo ErrRt
ExitRt:
Exit Function
ErrRt:
MsgBox Err.Description
IsBlank = False
Resume ExitRt
End Function
Hence this function:
declare an array of what not:
dim myArray() as string
addtoarray myArray, "Some String"
* The isBlank function is far from perfect as is the addtoarray
function...I just find these useful
------------------------------------------------------------------------------------------------------------------------------
Public Function AddToArray(ByRef iArray As Variant, ByVal iVal As
Variant) As Variant
On Error GoTo ExitErr
BackIn:
ub = UBound(iArray)
If Not IsBlank(iArray(ub)) Then
ub = ub + 1
ReDim Preserve iArray(ub)
End If
iArray(ub) = iVal
ExitIt:
' Clean Up
Exit Function
ExitErr:
' Process Error
t = Err.Number
u = Err.Description
If Err.Number = 9 Then
ReDim iArray(0)
GoTo BackIn:
End If
GoTo ExitIt
End Function
Public Function IsBlank(ByVal expression As Variant) As Boolean
On Error GoTo ErrRt
IsBlank = False
If IsEmpty(expression) Then
IsBlank = True
ElseIf IsNull(expression) Then
IsBlank = True
ElseIf CStr(expression) = "" Then
IsBlank = True
End If
On Error GoTo ErrRt
ExitRt:
Exit Function
ErrRt:
MsgBox Err.Description
IsBlank = False
Resume ExitRt
End Function