LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 536
Default Concat a three column range into one cell Then Next...


This works pretty good, I select the cells in three adjacent columns and run the code, all the data is in one cell, AU2 in this case.

I would like to be able to run this code down column AU, say 25 rows. (adjustable, might be 60 next column I use it in)

The three cells I want to concat code to join are AU.Offset(0, -6).Resize(1, 3).
And there are blank cells. Where blank means all three of the cells to be joined will be blank

Example data is something like this.

GRP SN 2500 STIS * 300 * PN 1

Where the * denotes the next column (if it posts ok here).

Current result for the one-cell-at-a-time process looks like this in AU2.

GRP SN 2500 STIS300PN 1

I would prefer that the spaces were remove in the process to look like this.

GRPSN2500STIS300PN1

Thanks,
Howard


Option Explicit

Sub ConcatTest()
Range("AU2").ClearContents
Dim rngC As Range

For Each rngC In Selection

If Len(rngC) = 0 Then
[AU2] = [AU2] & " "
Else

[AU2] = [AU2] & rngC.Text

End If
Next
'Range("AU2").Select
End Sub
 
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
if row has duplicates, concat entries in another column? rchun Excel Discussion (Misc queries) 4 January 25th 14 11:29 AM
Concat rows - nmpb Excel Programming 13 January 17th 09 05:20 PM
Macro to concat row DavidH56 Excel Programming 10 June 5th 08 05:34 PM
Remove #VALUE! from ConCat Range Function Excel Helps Excel Worksheet Functions 5 January 23rd 08 01:37 PM
Loop through column headers to search from column name and get cell range Pie Excel Programming 9 December 29th 05 12:17 AM


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

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"