Stripping down to the basic numbers... (1 Viewer)

jfgambit

Kinetic Card Dealer
Local time
Today, 22:58
Joined
Jul 18, 2002
Messages
798
Ok, here we go...
I have a field called Attributes in a table which is fed from a website download and looks like this:

Example 1: Axis:90; Base Curve:8.6; Color:Aqua; Cylinder:-0.75; Diameter:14.5; Power:+0.25

Example 2: Base Curve:8.4; Diameter:14.0; Power:-5.25

Example 3: Base Curve:9.1 ( + Power Only); Power:+2.50; Diameter:14.0

I need it to be:

Example 1: 8.6 14.5 +0.25 -0.75 90 Aqua
Example 2: 8.4 14.0 -5.25
Example 3: 9.1 14.0 +2.50

In otherwords, I need just the attributes in this order: Base Curve, Diameter, Power, Cylinder, Axis, Color

Anyone have any ideas....
 
Last edited:

Hypernoodle

Registered User.
Local time
Today, 17:58
Joined
Mar 19, 2003
Messages
12
Here's some code you might have some fun with...



Option Explicit

Public Function test()
Dim nCount As Integer, nItem, arrItems() As String, arrOut() As String
Dim colIndex As New Collection

Dim sTest As String
'sTest = "Axis:90; Base Curve:8.6; Color:Aqua; Cylinder:-0.75; Diameter:14.5; Power:+0.25"
sTest = "Base Curve:8.4; Diameter:14.0; Power:-5.25 "

With colIndex
.Add 0, "Base Curve"
.Add 1, "Diameter"
.Add 2, "Power"
.Add 3, "Cylinder"
.Add 4, "Axis"
.Add 5, "Color"
End With
nCount = UBound(Split(sTest, ";"))
ReDim arrItems(nCount)
ReDim arrOut(5)
arrItems = Split(sTest, ";")
For nItem = 0 To nCount
arrOut(colIndex(Trim(Split(arrItems(nItem), ":")(0)))) = Split(arrItems(nItem), ":")(1)
Next nItem

Debug.Print Trim(Join(arrOut))

End Function
 

Users who are viewing this thread

Top Bottom