How to concanate two cells "line by line"
Solved/Closed
Related:
- How to concanate two cells "line by line"
- How to delete cells in word - Guide
- Based on the values in cells b77 b81 c77 - Excel Forum
- Insert a function in cell b2 to display the current date from your system. ✓ - Excel Forum
- Excel arrow keys not moving cells - Guide
- Excel diagonal line in cell ✓ - Excel Forum
2 responses
rizvisa1
Posts
4478
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
May 5, 2022
766
Apr 22, 2012 at 05:26 PM
Apr 22, 2012 at 05:26 PM
You have to use a macro to do it
here is a custom function that can do it
If you don't want function, you can use copy / paste special to convert to values or convert the function to a macro that can do the same
current usage would be some thing like this
=combineCells(F5,G5)
here is a custom function that can do it
If you don't want function, you can use copy / paste special to convert to values or convert the function to a macro that can do the same
current usage would be some thing like this
=combineCells(F5,G5)
Public Function combineCells(rng1 As Range, rng2 As Range) As String
Dim vFirst As Variant
Dim vSecond As Variant
Dim iIndex As Integer
Dim sNewValue As String
vFirst = Split(rng1, Chr(10))
vSecond = Split(rng2, Chr(10))
sNewValue = vbNullString
For iIndex = LBound(vFirst) To UBound(vFirst)
If (sNewValue <> vbNullString) Then sNewValue = sNewValue & Chr(10)
sNewValue = sNewValue & vFirst(iIndex) & " " & vSecond(iIndex)
Next iIndex
If (sNewValue = vbNullString) Then sNewValue = ""
combineCells = sNewValue
End Function