K
Karol_tom
Hi,
I want to copy some information from pasted in inputbox
all pasted information have format:
xxxxxx COMPANY_NAME xxxxxx x x xxxxxxxx
where company name can contain one space, two or no space
I have big problem - I cant read properly company name - what's wrong ?
Dim zmienna As String
Dim n(1 To 13), z As Integer
zmienna = Application.InputBox("Podaj warto¶æ zmiennej", "zmienna", "111111
gulacz company sc 111114 S 9 PL7755533")
If Len(zmienna) < 6 Then
MsgBox "Nieprawid³owe dane", vbCritical
Exit Sub
End If
'find all spacebar
z = 1
For i = 1 To Len(zmienna)
If ((Mid(zmienna, i, 1)) = " ") Then
n(z) = i
z = z + 1
End If
Next i
adr_number = Left(zmienna, n(1) - 1)
If Len(adr_number) <> 6 Then
MsgBox "co¶ tu jest nie tak - adress number ró¿ny od 6 znaków", vbCritical
Exit Sub
End If
MsgBox ("Pierwsza czê¶æ" & adr_number)
'Tax-ID
tax = Right(zmienna, Len(zmienna) - n(z - 1))
MsgBox ("ostatnia czê¶æ" & tax & "OK")
'company name
Al_name = Mid(zmienna, n(1), (Len(zmienna) + 2 - (n(z - 4) + n(1))))
MsgBox ("company name" & Al_name & "OK")
I want to copy some information from pasted in inputbox
all pasted information have format:
xxxxxx COMPANY_NAME xxxxxx x x xxxxxxxx
where company name can contain one space, two or no space
I have big problem - I cant read properly company name - what's wrong ?
Dim zmienna As String
Dim n(1 To 13), z As Integer
zmienna = Application.InputBox("Podaj warto¶æ zmiennej", "zmienna", "111111
gulacz company sc 111114 S 9 PL7755533")
If Len(zmienna) < 6 Then
MsgBox "Nieprawid³owe dane", vbCritical
Exit Sub
End If
'find all spacebar
z = 1
For i = 1 To Len(zmienna)
If ((Mid(zmienna, i, 1)) = " ") Then
n(z) = i
z = z + 1
End If
Next i
adr_number = Left(zmienna, n(1) - 1)
If Len(adr_number) <> 6 Then
MsgBox "co¶ tu jest nie tak - adress number ró¿ny od 6 znaków", vbCritical
Exit Sub
End If
MsgBox ("Pierwsza czê¶æ" & adr_number)
'Tax-ID
tax = Right(zmienna, Len(zmienna) - n(z - 1))
MsgBox ("ostatnia czê¶æ" & tax & "OK")
'company name
Al_name = Mid(zmienna, n(1), (Len(zmienna) + 2 - (n(z - 4) + n(1))))
MsgBox ("company name" & Al_name & "OK")