stuff characters or use a template?


Posted by Will on December 04, 2001 9:22 AM

Hello,
Can someone help me with this problem?
I have a text field that requires a character to be stuffed into it every 2 positions.
IE: a1b2c3d4 needs to be a1;b2;c3;d4
Can you help?
Thanks,
Will



Posted by Colo on December 05, 2001 9:26 PM

Hi!
Can I use VBA?
Here's a simple function macro.

Public Function Stuffed(str As String)
Dim i As Integer, strTmp As String
For i = 1 To Len(str) Step 2
strTmp = strTmp & Mid(str, i, 2) & ";"
Next
Stuffed = Left(strTmp, Len(strTmp) - 1)
End Function

Please copy this code to mojule.
if you input in a cell like this,
=Stuffed("a1b2c3d4")

It will be displayed like this.
a1;b2;c3;d4