OVH Cloud OVH Cloud

How to use "CONCATENATE" function in VBA

6 réponses
Avatar
mar_male
Hello
How can I do something like this I want to add to all cells in range
Range("A:A").SpecialCells(xlCellTypeConstants) a prefix string like UT_
for example. I know there is a "character" but how i can use it for ma
Range
____A_____B____
1 | UT_string | |
2 | UT_string | |
3 | UT_string | |
4 | UT_string | |
..........................
40| UT_string | |
41| | |
Thanks for response

6 réponses

Avatar
Pounet95
Hello ( one more )

Use the symbol &

A="TOTO"
B=" JULES"

c=A & B ---> TOTO JULES

--
Pounet95
on trouve tout ( ou presque ) http://www.excelabo.net/
Conseillé :
http://dj.joss.free.fr/netiquet.htm
(charte, nétiquette, conseils, abréviations, souriettes...)
http://www.excelabo.net/mpfe/connexion.php
(connexion, conseils...)

a écrit dans le message de news:

Hello
How can I do something like this I want to add to all cells in range
Range("A:A").SpecialCells(xlCellTypeConstants) a prefix string like UT_
for example. I know there is a "character" but how i can use it for ma
Range
____A_____B____
1 | UT_string | |
2 | UT_string | |
3 | UT_string | |
4 | UT_string | |
..........................
40| UT_string | |
41| | |
Thanks for response



Avatar
jb
Hello,

Sub essai()
Range("A:A").SpecialCells(xlCellTypeConstants).Select
For Each c In Selection
c.Value = "UT_string " & c.Value
Next c
End Sub

JB
Avatar
mar_male
Thanks for answer.
I have another problem (I not good in programing)
I want to do something like this that i have in column A strings like
____A_____B____
1 | low | |
2 | high | |
3 | medium | |
4 | LowLow | |
..........................
40| | |
41| | |
I want to search column A and when it is string "low" in cell A1 write
"1" to B1
when it is string "high" in A2 write "2" in B2
When it is "string" medium in A3 write in cell B3 "6"
Could you tell me how I can do it in a quickly way?
Thanks for response
Avatar
jb
Sub essai()
Range("a1", Range("A1").End(xlDown)).Select
For Each c In Selection
Select Case c.Value
Case Is = "low"
temp = 1
Case Is = "hight"
temp = 2
Case Is = "medium"
temp = 6
Case Else
temp = 0
End Select
c.Offset(0, 1) = temp
Next c
End Sub

ou

Sub essai()
Columns("A:A").SpecialCells(xlCellTypeConstants, 3).Select
For Each c In Selection
Select Case c.Value
Case Is = "low"
temp = 1
Case Is = "hight"
temp = 2
Case Is = "medium"
temp = 6
Case Else
temp = 0
End Select
c.Offset(0, 1) = temp
Next c
End Sub

JB
Avatar
mar_male
Thanks for Answer.
Avatar
Ange Ounis
Not necessary to program anything :

B1 -> =EQUIV(A1;{"low"."high"."medium"."LowLow"};0)
(and copy from B1 to Bx)

The point might be replaced by , depending of your regional settings.
(EQUIV=MATCH in english, but don't know in polish).

----------
Ange Ounis
----------

Thanks for answer.
I have another problem (I not good in programing)
I want to do something like this that i have in column A strings like
____A_____B____
1 | low | |
2 | high | |
3 | medium | |
4 | LowLow | |
...........................
40| | |
41| | |
I want to search column A and when it is string "low" in cell A1 write
"1" to B1
when it is string "high" in A2 write "2" in B2
When it is "string" medium in A3 write in cell B3 "6"
Could you tell me how I can do it in a quickly way?
Thanks for response