Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Text Data

Status
Not open for further replies.

clayton74

Technical User
Apr 17, 2002
187
GB
I have a barcode reader and I want to have put the infomation from the barcode into differant cells. The infomation I get from the barcode is F69727/1%10, but the data i want splitting into differant cells is anything after the % sign into 1 cell and anything after F and before % sign into a differant cell. Any help would be gratefully recieved

Andy
 
Hi
This will do the job and will leave out the % altogether. If you require the % then either remove the -1 from the 'Left' function or add a +1 to the 'Right' funtion, depending on your requirements.

Code:
Sub lime()
Dim strString As String
strString = "F69727/1%10"
Range("A1") = Left(strString, InStr(strString, "%") - 1)
Range("B1") = Right(strString, Len(strString) - InStr(strString, "%"))
End Sub

;-)

If a man says something and there are no women there to hear him, is he still wrong? [ponder]
 
Sorry to be a pest, the code worked find but I dont require the "F" to be in A1. Thanks for taking the time to help
 
Hi
That's ok!!

This will do the trick but it relies on the data being in the same kind of format each time ie F####??##%##?? or what ever. The point being that your string begins with only one character you want to omit and always has the %

Code:
Range("A1") = Mid(strString, 2, InStr(strString, "%") - 2)

Happy Friday
;-)

If a man says something and there are no women there to hear him, is he still wrong? [ponder]
 
Loomah you are a hero thanks for your help and have a good weekend
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top