Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8
Default Concatenate Multiple Rows

I imported a table of data in excel. A common problem faced is that
the data spreads over multiple rows in one column. What i need to do
is then concatenate a few rows. Obviously there are over 300,000 rows
of data, so it will take me forever.

I have found a macro that does for me.

Sub Combine()
Dim J As Integer

If Selection.Cells.Count 1 Then
For J = 2 To Selection.Cells.Count
Selection.Cells(J).Value = _
Selection.Cells(1).Value & " " & _
Selection.Cells(J).Value
Selection.Cells(1).Clear
Next J
End If
End Sub

To use this macro, you select the cells you want to concatenate and
then run the macro. The contents of all the cells are combined into
the first cell in the selection, then whatever is in the other cells
is cleared.

However what i want to do is that The contents of all the cells are
combined into the LAST (not first) cell in the selection, then
whatever is in the other cells is cleared.

Can someone please suggest to me an alteration in this macro or a new
macro that will achieve the desired result. Thank you.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,520
Default Concatenate Multiple Rows


Dim J As Integer

If Selection.Cells.Count 1 Then
For J = 2 To Selection.Cells.Count
Selection.Cells(j).Value = _
Selection.Cells(J).Value & " " & _
Selection.Cells(1).Value
Selection.Cells(1).Clear
Next J
End If

--
If this post helps click Yes
---------------
Jacob Skaria


"Shamoun Ilyas" wrote:

I imported a table of data in excel. A common problem faced is that
the data spreads over multiple rows in one column. What i need to do
is then concatenate a few rows. Obviously there are over 300,000 rows
of data, so it will take me forever.

I have found a macro that does for me.

Sub Combine()
Dim J As Integer

If Selection.Cells.Count 1 Then
For J = 2 To Selection.Cells.Count
Selection.Cells(J).Value = _
Selection.Cells(1).Value & " " & _
Selection.Cells(J).Value
Selection.Cells(1).Clear
Next J
End If
End Sub

To use this macro, you select the cells you want to concatenate and
then run the macro. The contents of all the cells are combined into
the first cell in the selection, then whatever is in the other cells
is cleared.

However what i want to do is that The contents of all the cells are
combined into the LAST (not first) cell in the selection, then
whatever is in the other cells is cleared.

Can someone please suggest to me an alteration in this macro or a new
macro that will achieve the desired result. Thank you.

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8
Default Concatenate Multiple Rows

thank for trying. but this change does not work.
  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,646
Default Concatenate Multiple Rows

Sub Combine()
Dim J As Integer
If Selection.Cells.Count 1 Then
combcont = ""
For J = 1 To Selection.Cells.Count
combcont = combcont & Selection.Cells(J).Value & " "
Selection.Cells(J).Clear
Next J
Selection.Cells(J - 1).Value = Trim(combcont)
End If
End Sub

Regards,
Stefi


€˛Shamoun Ilyas€¯ ezt Ć*rta:

I imported a table of data in excel. A common problem faced is that
the data spreads over multiple rows in one column. What i need to do
is then concatenate a few rows. Obviously there are over 300,000 rows
of data, so it will take me forever.

I have found a macro that does for me.

Sub Combine()
Dim J As Integer

If Selection.Cells.Count 1 Then
For J = 2 To Selection.Cells.Count
Selection.Cells(J).Value = _
Selection.Cells(1).Value & " " & _
Selection.Cells(J).Value
Selection.Cells(1).Clear
Next J
End If
End Sub

To use this macro, you select the cells you want to concatenate and
then run the macro. The contents of all the cells are combined into
the first cell in the selection, then whatever is in the other cells
is cleared.

However what i want to do is that The contents of all the cells are
combined into the LAST (not first) cell in the selection, then
whatever is in the other cells is cleared.

Can someone please suggest to me an alteration in this macro or a new
macro that will achieve the desired result. Thank you.

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8
Default Concatenate Multiple Rows

Thank you Stefi. Your help is much appreciated.


  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,646
Default Concatenate Multiple Rows

You are welcome! Thanks for the feedback!
Stefi

€˛Shamoun Ilyas€¯ ezt Ć*rta:

Thank you Stefi. Your help is much appreciated.

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
How to concatenate many rows in Excel Christina Haney Excel Worksheet Functions 3 January 17th 09 02:10 PM
Concatenate several rows Fuzzy Excel Worksheet Functions 4 April 23rd 08 02:06 PM
Concatenate many rows quickly [email protected] Excel Worksheet Functions 5 March 31st 08 12:09 AM
Concatenate multiple rows and columns into 1 cell mj44 Excel Discussion (Misc queries) 21 July 19th 07 09:18 AM
How do I Concatenate these Dynamic Rows AwkSed2Excel Excel Worksheet Functions 7 June 7th 05 03:30 AM


All times are GMT +1. The time now is 11:25 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"