ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Concatenate (https://www.excelbanter.com/excel-programming/312471-concatenate.html)

[email protected]

Concatenate
 
Am trying to cancatenate one column in Excel. It has +950
rows, want to add "RS8" to each cell value, cell value is
text like "-009" (4 charactors only), so each cell value
will become RS8 + Cell.Value ("RS8-009")
Thanks in advance.
Rick

Terry V

Concatenate
 
This is one way that it will work for you. Im sure there are many others
with another solution.

Sub test3()
Dim rng As Range
Dim val As String
Dim addval As String

Set rng = Range("B2:B1000") 'set the range of cells to be affected
addval = "RS8" 'initialize the text to add to the start of the
contents
For Each cl In rng ' cycle through the cells
val = addval & cl.Value ' add the value to the beginning of the
cell contents
cl.Value = val 'place the new value as the value of the cell
Next cl

End Sub

HTH
Terry


" wrote in message
...
Am trying to cancatenate one column in Excel. It has +950
rows, want to add "RS8" to each cell value, cell value is
text like "-009" (4 charactors only), so each cell value
will become RS8 + Cell.Value ("RS8-009")
Thanks in advance.
Rick




rick

Concatenate
 
Terry
THANKS for reply. I'll give this a try.
I think I see how that works thanks to your input.
Rick
-----Original Message-----
This is one way that it will work for you. Im sure

there are many others
with another solution.

Sub test3()
Dim rng As Range
Dim val As String
Dim addval As String

Set rng = Range("B2:B1000") 'set the range of

cells to be affected
addval = "RS8" 'initialize the text to add to

the start of the
contents
For Each cl In rng ' cycle through the cells
val = addval & cl.Value ' add the value to

the beginning of the
cell contents
cl.Value = val 'place the new value as the

value of the cell
Next cl

End Sub

HTH
Terry


"

wrote in message
...
Am trying to cancatenate one column in Excel. It has

+950
rows, want to add "RS8" to each cell value, cell value

is
text like "-009" (4 charactors only), so each cell

value
will become RS8 + Cell.Value ("RS8-009")
Thanks in advance.
Rick



.



All times are GMT +1. The time now is 08:10 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com