Excel 2010/Snippets/General

String
'@val - String value, A string ending in numbers 'Notes: ' - 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 Else Exit For End If   Next
 * Returns the trailing numbers of a string as Long data-type.

GetNumericValue = ret End Function

'Returns a Boolean value of whether the '@val - String value, Text to verify 'Notes: ' - 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 Else IsNullOrEmpty = False End If End Function
 * Checks whether the String value is Empty or Nothing. Solves the problem with the lack of this method being available in VBA.