Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Join text
Dear all I would like to write an macro which will be join value of 3 columns into 1 column. Example: A1 = "A" B1 = "B" C1 = "C" A2 = "X" B2 = "Y" C2= "Z" After run this macro then A1= "ABC" B1= "" C1= "" A2="XYZ" B2="" C2="" Please guide me how to do that! Many thanks Thanh Nguyen -- thanhnguyen ------------------------------------------------------------------------ thanhnguyen's Profile: http://www.excelforum.com/member.php...o&userid=30502 View this thread: http://www.excelforum.com/showthread...hreadid=512135 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Join text
Hi Thanh,
Try: '============= Public Sub Tester1() Dim WB As Workbook Dim SH As Worksheet Dim Rng As Range Dim rCell As Range Dim LRow As Long Dim CalcMode As Long Set WB = ActiveWorkbook '<<==== CHANGE Set SH = WB.Sheets("Sheet2") '<<==== CHANGE LRow = Cells(Rows.Count, "A").End(xlUp).Row Set Rng = Range("A2:A" & LRow) On Error GoTo XIT With Application CalcMode = .Calculation .Calculation = xlCalculationManual .ScreenUpdating = False End With For Each rCell In Rng.Cells With rCell .Value = .Value & .Offset(0, 1).Value & .Offset(0, 2).Value .Offset(0, 1).Resize(1, 2).ClearContents End With Next rCell XIT: With Application .Calculation = CalcMode .ScreenUpdating = True End With End Sub '<<============= --- Regards, Norman "thanhnguyen" wrote in message ... Dear all I would like to write an macro which will be join value of 3 columns into 1 column. Example: A1 = "A" B1 = "B" C1 = "C" A2 = "X" B2 = "Y" C2= "Z" After run this macro then A1= "ABC" B1= "" C1= "" A2="XYZ" B2="" C2="" Please guide me how to do that! Many thanks Thanh Nguyen -- thanhnguyen ------------------------------------------------------------------------ thanhnguyen's Profile: http://www.excelforum.com/member.php...o&userid=30502 View this thread: http://www.excelforum.com/showthread...hreadid=512135 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Join text
Hi Norman Thanks so much, very great! Thanh Nguyen -- thanhnguyen ------------------------------------------------------------------------ thanhnguyen's Profile: http://www.excelforum.com/member.php...o&userid=30502 View this thread: http://www.excelforum.com/showthread...hreadid=512135 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Text join formulas working but act as straight text when modified | New Users to Excel | |||
join text | Excel Discussion (Misc queries) | |||
How do I join text from 2 cells, and make them appear in 2 lines | Excel Discussion (Misc queries) | |||
Join text | Excel Discussion (Misc queries) | |||
Delete Spaces and Join Text in Cell | Excel Worksheet Functions |