View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Claus Busch Claus Busch is offline
external usenet poster
 
Posts: 3,872
Default Concatenate a row that is selected and include blank cells

Hi Howard,

Am Sat, 15 Jun 2013 21:27:30 -0700 (PDT) schrieb Howard:

Well, drat! I should have seen this before I posted.
I want to select a variable range of cells in a row and while selected run this little macro.

Sub ConCatAK_15()
Range("AK15").Formula = "=ConcatMe(A1:H1)"
End Sub


if you want to concatenate A and activecell.row: H and Activecell.row
try:
Sub ConcatMe()
Dim rngC As Range
With ActiveCell
For Each rngC In Range(Cells(.Row, 1), Cells(.Row, 8))
[AK15] = [AK15] & rngC.Text
Next
End With
End Sub

if you only want to concatenate your selected cells try:

Sub ConcatMe2()
Dim rngC As Range

For Each rngC In Selection
[AK15] = [AK15] & rngC.Text
Next
End Sub


Regards
Claus Busch
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2