Hello!
I'm trying to develop the concatenate UDF, that should concatenate values in 2 columns for each row:
[TABLE="width: 500"]
<tbody>[TR]
[TD]A
[/TD]
[TD]B
[/TD]
[TD]C (UDF)
[/TD]
[TD]C (correct value)
[/TD]
[TD]C (incorrect value)<strike></strike>
[/TD]
[/TR]
[TR]
[TD]Ford
[/TD]
[TD]Escort
[/TD]
[TD]=ConcatData<strike></strike>(1,2)
[/TD]
[TD]Ford Escort
[/TD]
[TD]Ford Escort<strike></strike>
[/TD]
[/TR]
[TR]
[TD]Ford
[/TD]
[TD]Mustang
[/TD]
[TD]=ConcatData<strike></strike>(1,2)<strike></strike>
[/TD]
[TD]Ford Mustang
[/TD]
[TD]Ford Escort<strike></strike>
[/TD]
[/TR]
</tbody>[/TABLE]
In column "C (correct value)" - the values I want to get, in column "C (incorrect value)<strike></strike>" - the values I getting now.
I need your advise.
Thank you in advance.
I'm trying to develop the concatenate UDF, that should concatenate values in 2 columns for each row:
Code:
Function ConcatData(a As Integer, b As Integer) As Variant
For i = 1 To Cells(Rows.Count, a).End(xlUp).Row
ConcatData = Cells(i, a).Value & " " & Cells(i, b).Value
Next i
End Function
[TABLE="width: 500"]
<tbody>[TR]
[TD]A
[/TD]
[TD]B
[/TD]
[TD]C (UDF)
[/TD]
[TD]C (correct value)
[/TD]
[TD]C (incorrect value)<strike></strike>
[/TD]
[/TR]
[TR]
[TD]Ford
[/TD]
[TD]Escort
[/TD]
[TD]=ConcatData<strike></strike>(1,2)
[/TD]
[TD]Ford Escort
[/TD]
[TD]Ford Escort<strike></strike>
[/TD]
[/TR]
[TR]
[TD]Ford
[/TD]
[TD]Mustang
[/TD]
[TD]=ConcatData<strike></strike>(1,2)<strike></strike>
[/TD]
[TD]Ford Mustang
[/TD]
[TD]Ford Escort<strike></strike>
[/TD]
[/TR]
</tbody>[/TABLE]
In column "C (correct value)" - the values I want to get, in column "C (incorrect value)<strike></strike>" - the values I getting now.
I need your advise.
Thank you in advance.