swaggerbox
10-12-2018, 04:13 AM
The code below will return the output:
red 10-16
aconite 13-17
suberect spatholobus stem 5-15
tianxiong 12-18
ligusticum striatum 2-4
celastreae 25-35
maca 10-18
eucommia bark 18-22
fennel 10-20
radix paeoniae alba 3-5
raw rheum officinale 10-18
honeysuckle 10-20
rhizoma arisaematis 10-20
radix astragali 4-8
talc 5-16
asarum 2-4
notopterygium root 16-20
dried orange peel 8-25
radix codonopsitis 2-6
root of kudzu vine 10-20
pangolin 17-23
rehmannia glutinosa 8-25
ground beeltle 11-15
semen brassicae 5-15
rhododendron molle 2-4
distilled spirit 200-300
How do I change the code so that the output is formatted this way:
10-16 pts wt. red
13-17 pts wt. aconite
5-15 pts wt. suberect spatholobus stem
12-18 pts wt. tianxiong
2-4 pts wt. ligusticum striatum
10-18 pts wt. celastreae
25-35 pts wt. maca
18-22 pts wt. eucommia bark
10-20 pts wt. fennel
3-5 pts wt. radix paeoniae alba
10-18 pts wt. raw rheum officinale
10-20 pts wt. honeysuckle
10-20 pts wt. rhizoma arisaematis
4-8 pts wt. radix astragali
5-16 pts wt. talc
2-4 pts wt. asarum
16-20 pts wt. notopterygium root
8-25 pts wt. dried orange peel
2-6 pts wt. radix codonopsitis
10-20 pts wt. root of kudzu vine
17-23 pts wt. pangolin
8-25 pts wt. rehmannia glutinosa
11-15 pts wt. ground beeltle
5-15 pts wt. semen brassicae
2-4 pts wt. rhododendron molle
200-300 pts wt. distilled spirit
Sub Test()
Dim str As String
str = "red, 10-16 parts of aconite, 13-17 parts of suberect spatholobus stem, 5-15 parts of tianxiong, 12-18 parts ligusticum striatum, _
2-4 parts celastreae, 25-35 parts maca, 10-18 parts of eucommia bark, 18-22 parts of fennel, 10-20 parts of radix paeoniae alba, _
3-5 parts of raw rheum officinale, 10-18 parts of honeysuckle, 10-20 parts of rhizoma arisaematis, 10-20 parts of radix astragali, _
4-8 parts of talc, 5-16 parts of asarum, 2-4 parts of notopterygium root, 16-20 parts of dried orange peel, 8-25 parts of radix codonopsitis, _
2-6 parts of root of kudzu vine, 10-20 parts of pangolin, 17-23 parts of rehmannia glutinosa, 8-25 parts of ground beeltle, _
11-15 parts of semen brassicae, 5-15 parts of rhododendron molle 2-4 shares, distilled spirit 200-300 shares"
str = Replace(str, ",", "")
str = Replace(str, "parts of ", "pts wt.,")
str = Replace(str, "parts ", "pts wt.,")
str = Replace(str, "shares of ", "pts wt.,")
str = Replace(str, "shares ", "pts wt.,")
str = Replace(str, "shares", "pts wt.,")
Dim a As Variant
Dim b As Variant
a = Split(str, "pts wt.,")
b = UBound(a)
For i = 0 To b
Debug.Print a(i)
Next i
End Sub
red 10-16
aconite 13-17
suberect spatholobus stem 5-15
tianxiong 12-18
ligusticum striatum 2-4
celastreae 25-35
maca 10-18
eucommia bark 18-22
fennel 10-20
radix paeoniae alba 3-5
raw rheum officinale 10-18
honeysuckle 10-20
rhizoma arisaematis 10-20
radix astragali 4-8
talc 5-16
asarum 2-4
notopterygium root 16-20
dried orange peel 8-25
radix codonopsitis 2-6
root of kudzu vine 10-20
pangolin 17-23
rehmannia glutinosa 8-25
ground beeltle 11-15
semen brassicae 5-15
rhododendron molle 2-4
distilled spirit 200-300
How do I change the code so that the output is formatted this way:
10-16 pts wt. red
13-17 pts wt. aconite
5-15 pts wt. suberect spatholobus stem
12-18 pts wt. tianxiong
2-4 pts wt. ligusticum striatum
10-18 pts wt. celastreae
25-35 pts wt. maca
18-22 pts wt. eucommia bark
10-20 pts wt. fennel
3-5 pts wt. radix paeoniae alba
10-18 pts wt. raw rheum officinale
10-20 pts wt. honeysuckle
10-20 pts wt. rhizoma arisaematis
4-8 pts wt. radix astragali
5-16 pts wt. talc
2-4 pts wt. asarum
16-20 pts wt. notopterygium root
8-25 pts wt. dried orange peel
2-6 pts wt. radix codonopsitis
10-20 pts wt. root of kudzu vine
17-23 pts wt. pangolin
8-25 pts wt. rehmannia glutinosa
11-15 pts wt. ground beeltle
5-15 pts wt. semen brassicae
2-4 pts wt. rhododendron molle
200-300 pts wt. distilled spirit
Sub Test()
Dim str As String
str = "red, 10-16 parts of aconite, 13-17 parts of suberect spatholobus stem, 5-15 parts of tianxiong, 12-18 parts ligusticum striatum, _
2-4 parts celastreae, 25-35 parts maca, 10-18 parts of eucommia bark, 18-22 parts of fennel, 10-20 parts of radix paeoniae alba, _
3-5 parts of raw rheum officinale, 10-18 parts of honeysuckle, 10-20 parts of rhizoma arisaematis, 10-20 parts of radix astragali, _
4-8 parts of talc, 5-16 parts of asarum, 2-4 parts of notopterygium root, 16-20 parts of dried orange peel, 8-25 parts of radix codonopsitis, _
2-6 parts of root of kudzu vine, 10-20 parts of pangolin, 17-23 parts of rehmannia glutinosa, 8-25 parts of ground beeltle, _
11-15 parts of semen brassicae, 5-15 parts of rhododendron molle 2-4 shares, distilled spirit 200-300 shares"
str = Replace(str, ",", "")
str = Replace(str, "parts of ", "pts wt.,")
str = Replace(str, "parts ", "pts wt.,")
str = Replace(str, "shares of ", "pts wt.,")
str = Replace(str, "shares ", "pts wt.,")
str = Replace(str, "shares", "pts wt.,")
Dim a As Variant
Dim b As Variant
a = Split(str, "pts wt.,")
b = UBound(a)
For i = 0 To b
Debug.Print a(i)
Next i
End Sub