HarryCallaghan
Board Regular
- Joined
- Jan 30, 2013
- Messages
- 50
Hello.
I'm making a system to read codebar from documents and extract info from a database using this codebar. The problem is that this codebar is composed by a "serial" and a "code", both numbers separated by a bar "-". Codebars are such as "2-234", "10-543789" and strings like that. The serial number (the left partt of the string can be a number between 1 and 11 and the code part can be a number between 1 and 999999. I have this code a wrote by myself but i'm getting an error about types not matching i guess because you cant diff operate two strings , hope someone can help me:
I'm making a system to read codebar from documents and extract info from a database using this codebar. The problem is that this codebar is composed by a "serial" and a "code", both numbers separated by a bar "-". Codebars are such as "2-234", "10-543789" and strings like that. The serial number (the left partt of the string can be a number between 1 and 11 and the code part can be a number between 1 and 999999. I have this code a wrote by myself but i'm getting an error about types not matching i guess because you cant diff operate two strings , hope someone can help me:
Code:
Sub InputCodigo()
Dim Albaran As String
Albaran = "default"
Do Until Len(Albaran) = 0
Albaran = InputBox("testing etiquetas")
If Right(Left(Albaran, 2), 1) = "-" Then
Cells(2, "J").Value = Left(Albaran, 1)
Cells(2, "K").Value = Albaran - Left(Albaran, 2)
ElseIf Right(Left(Albaran, 2), 1) <> "-" Then
Cells(2, "J").Value = Left(Albaran, 2)
Cells(2, "K").Value = Albaran - Left(Albaran, 3)
End If
Loop
End Sub
Last edited: