Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Tom Tom is offline
external usenet poster
 
Posts: 17
Default Combining Cell Contents

Hello,

Need help in moving column contents without overwriting existing
contents. Example - Cell A1 contents is "1234/", cell B2 is "55". Want
to move all of column B to column A without overwriting the cells in
column A. In example cell A1 would end up reading "1234/55".

Thanks,
Tom

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 116
Default Combining Cell Contents

Hi Tom,

Manually:

Select Column B
Insert Column
Select B1
Insert formula =A1&C1
Copy formula to last Row
Copy Column B
PasteSpecial Values
Select Column A
Delete

With VBA: (probably isn't the best way but works for me)

Sub CombineAandB()
Application.ScreenUpdating = False
Columns("B:B").Insert Shift:=xlToRight
Range("B1").FormulaR1C1 = "=A1&C1"
Range("B1:B" & Cells(Rows.Count, "A").End(xlUp).Row).FillDown
Columns("B:B").Select
Selection.Copy
Selection.PasteSpecial xlvalues
Columns("A:A").Select
Selection.Delete
Range("A1").Select
Application.ScreenUpdating = True
End Sub

Both do means do replace the contents in column A.

Alan


"Tom" wrote in message
oups.com...
Hello,

Need help in moving column contents without overwriting existing
contents. Example - Cell A1 contents is "1234/", cell B2 is "55". Want
to move all of column B to column A without overwriting the cells in
column A. In example cell A1 would end up reading "1234/55".

Thanks,
Tom



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default Combining Cell Contents

one way

Sub Combine_And_B()
Dim ws As Worksheet
Dim lastrow As Long, i As Long
Set ws = Worksheets("Sheet1")
lastrow = ws.Cells(Rows.Count, "A").End(xlUp).Row
Application.ScreenUpdating = False

For i = 1 To lastrow ' change 1 to your first row with data
ws.Range("A" & i).Value = ws.Range("A" & i).Value & _
ws.Range("B" & i).Value
Next
Application.ScreenUpdating = True


End Sub


--


Gary


"Tom" wrote in message
oups.com...
Hello,

Need help in moving column contents without overwriting existing
contents. Example - Cell A1 contents is "1234/", cell B2 is "55". Want
to move all of column B to column A without overwriting the cells in
column A. In example cell A1 would end up reading "1234/55".

Thanks,
Tom



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Combining Cell Contents

Sub ConCatB()
Range("A1").Value = Range("A1").Value & Range("B1").Value
End Sub

--
Regards,
Tom Ogilvy

"Tom" wrote in message
oups.com...
Hello,

Need help in moving column contents without overwriting existing
contents. Example - Cell A1 contents is "1234/", cell B2 is "55". Want
to move all of column B to column A without overwriting the cells in
column A. In example cell A1 would end up reading "1234/55".

Thanks,
Tom



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default Combining Cell Contents

Tom

=A1&B1

Or do you want a VBA method.

Sub test()
Dim rng As Range
Set rng = Range(Cells(1, "A"), Cells(Rows.Count, "A").End(xlUp))
For Each cell In rng
cell.Value = cell.Value & cell.Offset(0, 1).Value
' cell.Offset(0, 1).ClearContents 'optional
Next
End Sub


Gord Dibben MS Excel MVP



On 28 Jan 2007 10:56:03 -0800, "Tom" wrote:

Hello,

Need help in moving column contents without overwriting existing
contents. Example - Cell A1 contents is "1234/", cell B2 is "55". Want
to move all of column B to column A without overwriting the cells in
column A. In example cell A1 would end up reading "1234/55".

Thanks,
Tom


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
Combining Contents of cells into one cell ExcelChallenge Excel Worksheet Functions 5 November 4th 08 07:37 PM
Combining Cell Contents (Part 2) PaolaAndrea Excel Discussion (Misc queries) 3 May 9th 08 08:10 PM
Combining Cell Contents PaolaAndrea Excel Discussion (Misc queries) 5 May 9th 08 05:38 PM
Combining Cell Contents Storm Excel Worksheet Functions 4 April 14th 07 04:42 AM
Combining cell contents when there is content to combine Richard Excel Discussion (Misc queries) 2 June 21st 06 07:30 PM


All times are GMT +1. The time now is 10:51 AM.

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"