LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22,906
Default Concatenate By Selection

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(1).Value = Trim(combcont)
End If
End Sub


Gord Dibben MS Excel MVP


On Wed, 16 Dec 2009 12:00:29 -0800 (PST), "Marshall.Harris"
wrote:

Okay... I've found a nice macro to accomplish this. However, the
result ends up in the final cell as opposed to the top cell.

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

What can I add to this macro in order to move the string to the top-
most cell of the selection?

Credit to for the macro by the way.

-Marshall

On Dec 16, 2:41*pm, "Marshall.Harris"
wrote:
I'd like to develop a function/macro to use that will allow me to
concatenate two or more cells based on the cells I select. As I scroll
down in my data, sometimes there are two cells that must be
concatenated, but sometimes it is three or more. In the end I am
hoping to come up with a simple way to highlight the cells and hit a
quick user-defined shortcut key to replace the top-most cell with the
concatenation of the cells I've selected. I'm using Excel 2007.

Can anyone help me figure this one out?

-Marshall


 
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
Limiting selection in a cell AND linking that selection to a list Lisa Excel Discussion (Misc queries) 1 July 28th 09 05:00 PM
Copy Selection - Transpose Selection - Delete Selection Uninvisible Excel Discussion (Misc queries) 2 October 23rd 07 04:18 PM
Identifying a selection of a selection of a range swimfast Excel Worksheet Functions 1 March 1st 07 02:51 AM
I know how to concatenate ,can one de-concatenate to split date? QUICK BOOKS PROBLEM- New Users to Excel 1 July 26th 05 05:07 PM
limit cell list selection based on the selection of another list lorraine Excel Worksheet Functions 2 December 14th 04 08:17 PM


All times are GMT +1. The time now is 03:32 PM.

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

About Us

"It's about Microsoft Excel"