Forum Home
Press F1
 
Thread ID: 100707 2009-06-18 01:01:00 Help needed on VBA excel code kbp (7436) Press F1
Post ID Timestamp Content User
783118 2009-06-18 01:01:00 Hi

Can some please help me if possible. I am not an expert on VBA excel, just know a little bit.

I am trying to do a development on a template with a barcode and I am having some trouble in the Excel VBA code. A new field has been created example called "Name" and I have written a code to pick this up from the automation box. The only problem I am getting is the words do not split eg: ABC Company Ltd - appears as ABCCompanyLtd when the barcode is printed.

So need some code in the excel spreadsheet to say convert "space" into "slash". Because the scan barcode program converts it the other way round - Slash into space, which will then it will be right. can you help me please with the code to convert space into slash. And also where in the VBA do I place the code?

Thanks very much.
kbp (7436)
783119 2009-06-18 02:13:00 Sub dtr()


Selection.Replace What:=" ", Replacement:="/", LookAt:=xlPart, SearchOrder _
:=xlByRows


End Sub
Rob99 (151)
783120 2009-06-18 02:18:00 Function SpaceToSlash(Name As String) As String
SpaceToSlash = Replace(Name, " ", "/")
End Function

So simple, you don't really need to make a separate function - just use the Replace function on your name in your existing VBA
MushHead (10626)
1