LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Concantenate All cells in Row left of current active cell--

Join is a VB function that takes a one-dimensional array of Strings (1st
argument) and concatenates its elements together using whatever text you
specify as the delimiter (2nd argument). The Range property returns an
array; but, unfortunately, that array is a two-dimensional one which the
Join function cannot use. As for the worksheet Transpose function... I'm not
entirely sure why it actually works, but it does, so I use it.<g All I know
is that a **vertical** range of cells, when TRANSPOSE'd, becomes a
one-dimensional array, but when a **horizontal** range of cells is
TRANSPOSE'd, it remains a two-dimensional array. That is why your horizontal
range had to be TRANSPOSE'd twice... the first time to make it a vertical
(two-dimensional) array and the second time to make it a horizontal
one-dimensional array.

--
Rick (MVP - Excel)


"Benjamin" wrote in message
...
By the way Rick, Really awesome and short code!
Can you explain or give me link, to help me understand
Join and Transpose. Works like a charm! Thanks again.

"Rick Rothstein" wrote:

Here is a non-looping solution for you to try...

Sub ConCat()
With WorksheetFunction
ActiveCell.Value = Join(.Transpose(.Transpose(Range("A" & _
ActiveCell.Row, ActiveCell.Offset(0, -1)))), ", ")
End With
End Sub

Note that I use a comma-space as a delimiter between the cell values (see
end of the long code line)... you can change this as necessary.

--
Rick (MVP - Excel)


"Benjamin" wrote in message
...
need code to concantenate all cells in row left of current active cell.
Say I click cell h2, I want cells a, b, c, d, e, f, g, to populate cell
h2.
I want to use this as a button on my excel toolbar. If I can create a
macro
for it then it would be really handy. As sometimes I'm concantenating
alot
of
data.

Is there a quick way to do that in vba?


.


 
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
scroll so that the upper left cell in a range moves to the upper left of the active window Andre[_6_] Excel Programming 6 November 14th 08 09:33 PM
Name of the current pivottable from active cell [email protected] Excel Programming 2 February 11th 08 09:45 AM
Moving left/right from active cell Kurt Barr[_2_] Excel Programming 3 January 4th 06 05:30 PM
Select column cells to the left/right of active selection - an example [email protected] Excel Programming 1 March 24th 05 06:36 PM
Moving the Active cell to the left of the screen Dave Bash Excel Programming 1 December 17th 03 04:11 PM


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