Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Combining colums in Excel
Hi,
I'd like to know how to take the text from cells in column B and "append" it to the text contained in column A. For example, here's what I have: Col A Col B good bad boy girl uncle aunt I'd like to modified Col A as below: Col A goodbad boygirl uncleaunt How can I do this? I tried to do this by writing the code below but that doesn't work since it's recursive. Worksheets("Temp3").Cells(startrow1, 4).Value = Worksheets("Temp3").Cells(startrow1, 4).Value & _ Worksheets("Temp3").Cells(startrow1, 4).Value & "," Thanks for help. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Combining colums in Excel
Give this macro a try...
Sub CombineAandB() Dim X As Long Dim LastRow As Long Const StartRow As Long = 2 With Worksheets("sheet 3") LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row For X = StartRow To LastRow .Cells(X, "A").Value = .Cells(X, "A").Value & .Cells(X, "B").Value Next ' Comment the following line out if you don't ' want to delete the contents of Column B .Range("B" & StartRow & ":B" & LastRow).Clear End With End Sub And note the commented line inside the code. -- Rick (MVP - Excel) "Varun" wrote in message ... Hi, I'd like to know how to take the text from cells in column B and "append" it to the text contained in column A. For example, here's what I have: Col A Col B good bad boy girl uncle aunt I'd like to modified Col A as below: Col A goodbad boygirl uncleaunt How can I do this? I tried to do this by writing the code below but that doesn't work since it's recursive. Worksheets("Temp3").Cells(startrow1, 4).Value = Worksheets("Temp3").Cells(startrow1, 4).Value & _ Worksheets("Temp3").Cells(startrow1, 4).Value & "," Thanks for help. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Combining all rows of two colums together into one column | Excel Worksheet Functions | |||
Combining Colums | Excel Discussion (Misc queries) | |||
In Excel the colums which used to be A,B,C D etc are now 1,2,3 | Excel Discussion (Misc queries) | |||
Combining workshhets with different number of colums and column wi | Excel Discussion (Misc queries) | |||
How do I name my colums in Excel ? | New Users to Excel |