I am new to this site and I am looking for help. I have programmed in VB before but not in applications such as Excel.
I have this code in a VBA module attached to a sheet.
Function RB(ByVal Code As String) As String
' Define variables first
Dim i As Integer ' loop counter
' Go through the Code string character by character
' copying only the numbers to RB
For i = 1 To Len(Code)
If IsNumber(Value(Mid(Code, i, 1))) Then
RB = RB + Mid(Code, i, 1)
End If
Next i
End Function
This is supposed to remove brackets around variable length numeric string data but when run from a cell "=RB(B2)", where B2 contains the string it produces a compiler error pointing to the word "Value" and saying Sub or Function not defined.
The string would start off like this "[1234567891234]" from a point of sale terminal device database as a reference to a bar code and I need to convert this to a printable bar code. I have another function that generates the printer codes and a font that will print bar codes from the printer codes but I am having trouble with removing the brackets from the database data. I thought I would use another function but this error has cropped up. I know this can be done in other ways but the error is a problematic (annoying).
What would cause this error?
Thanks in advance and I hope I have presented it in accordance with the rules.
Bookmarks