• Returns the trailing numbers of a string as Long data-type.

'@val - String value, A string ending in numbers
'   - The string of numbers at the end needs to be no more than the max value for Long
'       Data type, otherwise an OutOfBounds or OutOfRange exception might be thrown.
Function GetTrailingNumericValue(val As String) As Long
    Dim i As Long, tmp As Variant, ret As Variant
    For i = Len(val) To 1 Step -1
        tmp = mid(val, i, 1)
        If IsNumeric(tmp) Then
            ret = tmp & ret
            Exit For
        End If
    GetNumericValue = ret
End Function

  • Checks whether the String value is Empty or Nothing. Solves the problem with the lack of this method being available in VBA.

'Returns a Boolean value of whether the
'@val - String value, Text to verify
'   - This method is very useful in If Statements where you want to
'       verify that a String value is not Empty or Nothing.
Function IsNullOrEmpty(val As String) As Boolean
    'First conditional validates for Nothing
    'Second condition validates for an Empty String situation "" or "     "
    If (val & "" = "") Or (Len(Trim(val)) <= 0) Then
        IsNullOrEmpty = True
        IsNullOrEmpty = False
    End If
End Function

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.