Concatenate a range of cells
Malgven
-
Vahde Posted messages 3 Registration date Status Member Last intervention -
Vahde Posted messages 3 Registration date Status Member Last intervention -
Hello,
I would like to concatenate a range of cells in Excel so that my data contained in different cells are grouped into a single cell and separated by a comma.
My data consists of numbers with decimals separated by a point (e.g., 5.45) and I would like them to remain as such during the process.
I wanted to create an InputBox to select the range of cells I want to merge into one, but I'm completely stuck and can't get this macro to work!
Does anyone have an idea?
Thank you in advance.
Configuration: Windows / Firefox 45.0
I would like to concatenate a range of cells in Excel so that my data contained in different cells are grouped into a single cell and separated by a comma.
My data consists of numbers with decimals separated by a point (e.g., 5.45) and I would like them to remain as such during the process.
I wanted to create an InputBox to select the range of cells I want to merge into one, but I'm completely stuck and can't get this macro to work!
Does anyone have an idea?
Thank you in advance.
Configuration: Windows / Firefox 45.0
2 answers
-
Hello,
Try it like thisSub Test()
Dim ref As Range, Cel As Range
Dim Texte As String
Set ref = Application.InputBox("Please select the cells on the sheet", Type:=8)
For Each Cel In ref
Texte = Texte & Cel.Value & ", "
Next Cel
MsgBox "Concatenated values: " & Left(Texte, Len(Texte) - 2)
End Sub
See you! -
Hello,
The subject is a bit old, but I have a question.
I would like to replace the "," between the concatenated cells with a line break ALT+ENTER.
How can I do that, please?