Function FirstNumber(strNumber) 'As String 'Returns the first number in a string. For example 'CA0567-2 returns 0567 'If there are no numbers, an empty string is returned. Dim strBuffer Dim intCounter Dim blnNumeric If IsNull(strNumber) Then FirstNumber = "" Exit Function End If If strNumber = "" Then FirstNumber = "" Exit Function End If strBuffer = "" blnNumeric = False For intCounter = 1 To Len(strNumber) If IsNumeric(Mid(strNumber, intCounter, 1)) Then blnNumeric = True strBuffer = strBuffer & Mid(strNumber, intCounter, 1) Else If blnNumeric Then Exit For End If Next FirstNumber = strBuffer End Function