Sub ConcatAandBinC()
Dim LRw As Long
LRw = Cells(Rows.Count, "A").End(xlUp).Row
Application.ScreenUpdating = False
With Range("C1:C" & LRw)
.Formula = "=B1&CHAR(10)&A1"
.Value = .Value
.EntireColumn.AutoFit
End With
Application.ScreenUpdating = True
End Sub
Sub ConcatAandB()
[C1:C100] = [A1:A100&CHAR(10)&B1:B100]
End Sub
Sub ConcatAandB()
Dim LastRow As Long
LastRow = Cells(Rows.Count, "A").End(xlUp).Row
Range("C1:C" & LastRow) = Evaluate(Replace("A1:A#&CHAR(10)&B1:B#", "#", LastRow))
End Sub
Rick, OP indicated he wants B-cell text above A-cell text.Since you indicated A1:A100 and B1:B100 all had data in them, this macro should work for you...
If the cells will not be filled down all the way to 100, then give this a try instead...Code:Sub ConcatAandB() [C1:C100] = [[COLOR=#ff0000][B]A1:A100&CHAR(10)&B1:B100[/B][/COLOR]] End Sub
Code:Sub ConcatAandB() Dim LastRow As Long LastRow = Cells(Rows.Count, "A").End(xlUp).Row Range("C1:C" & LastRow) = Evaluate(Replace("A1:A#&CHAR(10)&B1:B#", "#", LastRow)) End Sub
Yikes! I completely missed that. Thanks for pointing that out.Rick, OP indicated he wants B-cell text above A-cell text.
Sub ConcatAandB()
[C1:C100] = [B1:B100&CHAR(10)&A1:A100]
End Sub
Sub ConcatAandB()
Dim LastRow As Long
LastRow = Cells(Rows.Count, "A").End(xlUp).Row
Range("C1:C" & LastRow) = Evaluate(Replace("B1:B#&CHAR(10)&A1:A#", "#", LastRow))
End Sub
What do you mean by this? Isn't the code that was provided what you asked for?And if I want to do the opposite i.e, the original again !
Do you mean put the A-cell text above the B-cell text? If so, just swap A for B. In the code I posted it would be this line:And if I want to do the opposite i.e, the original again !