Macro that for each value in the cell before and after it adds the text?

If it was in the Excel cell this value: M L XL
You need this:
select:Razmer:M:+0.0000:0:0:+0.00000000:1|select:Razmer:L:+0.0000:0:0:+0.00000000:1|select:Razmer:XL:+0.0000:0:0:+0.00000000:1|
March 20th 20 at 11:19
2 answers
March 20th 20 at 11:21
And what You here need help?
Where an example of Your achievements in which You have something does not work?
I can only add at the beginning of each symbol, but how can I add after do not know...
Sub Add_Plus()

Dim r As Range

With Selection

For Each r In Selection
r.Value ="select Size:M" & r.Value
Next

End With

End Sub - Alessandro_Daugherty commented on March 20th 20 at 11:24
If the string "M L XL" is Recorded in one cell, you first need to split the string into elements and then to change them, then assemble back

dim v as variant ' array of sizes
dim sData as string ' string processing

For Each r In Selection 

'Delete the extra spaces if there is
sData = WorksheetFuncion.trim(r.Value)

'The assumption that items are separated by spaces, splitting a string into an array
v=split(sData, " ")

'we now have in the array separately, all sizes
'do the loop size
dim i as long
sData = ""
for i = lbound(v) to ubound(v)
 'change the elements
 v(i) = "select Size:" & v(i) & ":+0.0000:0:0:+0.00000000:1"
next i
'putting the string back through the "|"character
sData = join(v, "|") 

Next
- darryl_Nicol commented on March 20th 20 at 11:27
@stuart_Brek, Strange,it says Invalid outside procedure - Alessandro_Daugherty commented on March 20th 20 at 11:30
The prep algorithm.
Just run step by step and find the error. - darryl_Nicol commented on March 20th 20 at 11:33
Yes there is a hike to the library to use, but I don't know what... - Alessandro_Daugherty commented on March 20th 20 at 11:36
Any libraries to include do not need.
All standard functions.
It's just not at a computer to get rid of it.
Try, read the help on each function, and when you understand the algorithm, everything will fall into place. - darryl_Nicol commented on March 20th 20 at 11:39
March 20th 20 at 11:23
If suddenly someone come in handy:
Private Sub Test() 'http://www.cyberforum.ru/vba/thread2445785.html
 Const template = "|select:Size:<SIZE>:+0.0000:0:0:+0.00000000:1"

 Dim a, e, i&, t1$, t2$, cNBS$, cS$: cNBS = Chr$(160): cS = Chr$(32)
 a = Range(Cells(2, "A"), Cells(Rows.Count, "A").End(xlUp)).Value
 For i = 1 To UBound(a)
 t1 = Format$(Trim$(a(i, 1)), "0,000")
 t1 = Replace(t1, cNBS, cS) 'can be written in one line
 For Each e In Split(t1)
 t2 = t2 & Replace(template, "<SIZE>", e)
Next
 a(i, 1) = Mid$(t2, 2): t2 = ""
Next
 Cells(2, "B").Resize(i - 1) = a 'the result in the adjacent column (for clarity)
End Sub

Find more questions by tags MacrosExcelOpenCart