#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Text join formulas working but act as straight text when modified akkrug New Users to Excel 3 May 14th 08 02:27 PM
join text RKS Excel Discussion (Misc queries) 7 April 15th 08 03:43 AM
How do I join text from 2 cells, and make them appear in 2 lines becerra Excel Discussion (Misc queries) 1 July 24th 07 04:30 PM
Join text Robert57 Excel Discussion (Misc queries) 7 December 22nd 05 03:14 PM
Delete Spaces and Join Text in Cell Diggsy Excel Worksheet Functions 3 October 5th 05 03:50 AM


All times are GMT +1. The time now is 02:55 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"