Thread: Trim Help
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
MDW MDW is offline
external usenet poster
 
Posts: 117
Default Trim Help

Not sure what you want to do with those codes. If you wanted to store them in
a variable, something like the code below should get you on your way.
Dim strTest As String
Dim arrCodes() As Byte
Dim I As Byte
Dim C As String * 3

' Change this line to point to whatever range or variable contains your
string, or however you want to load in the full text
strTest = "001005003003098050"

I = 1
ReDim arrCodes(0)

Do

C = Mid(strTest, I, 3)

ReDim Preserve arrCodes(UBound(arrCodes) + 1)
arrCodes(UBound(arrCodes)) = CByte(C)

MsgBox arrCodes(UBound(arrCodes))

I = I + 3

Loop Until I = Len(strTest)


--
Hmm...they have the Internet on COMPUTERS now!


"Tomkat743" wrote:

I need to look at a number and break it down to a basic series of codes. The
codes are from 001 to 100. They are sent to me in a format of
001005003003098050 This represents and needs to be broken down into
individule codes of 1,5,3,3,98,50 There is no set quanties or order it could
range to a single code 005 which equals a 5, to any number of codes combined
as a string. 005005010011012 which equals 5,5,10,11,12 do I have to use VBA
to do this or can I use a formula to extract the individule codes. The only
thing that is set is that each number is 3 digits and the string is always
read from left to right There is never a space nor are quotes or any other
characters used. Any Ideas?