Thread: Join text
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones Norman Jones is offline
external usenet poster
 
Posts: 5,302
Default 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