ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   CONCATENATING CELL CONTENTS ! (https://www.excelbanter.com/excel-programming/426772-concatenating-cell-contents.html)

Jay Dean

CONCATENATING CELL CONTENTS !
 
Hello -

Each cell in Range ("A5:A80") contains words or phrases.
I am trying to create a sentence in Range ("D3") using cells from Range
("A5:A80").
I need a macro that will copy the contents of any cell that I select in
Range ("A5:A80") and paste it in Range ("D3"). If Range("D3") already
contains some words, it will leave a space at the end of those words and
concatenate the cell content it copied in range ("A5:A80").

Any help would be appreciated. Thanks!

Jay Dean



*** Sent via Developersdex http://www.developersdex.com ***

Gord Dibben

CONCATENATING CELL CONTENTS !
 
Sub Add_Copied_Text()
Dim Cell As Range
Dim moretext As String
Dim rngEdit As Range
'select a cell with text
Set currentSelection = Application.ActiveCell
currentSelection.Name = "oldrange"
moretext = Range("oldrange").Value
'select a cell to satrt the fill
Set rngEdit = Range("D3")
rngEdit.Value = rngEdit.Value & " " & Range("oldrange").Value
End Sub


Gord Dibben MS Excel MVP

On Sat, 11 Apr 2009 18:50:46 -0700, jay dean wrote:

Hello -

Each cell in Range ("A5:A80") contains words or phrases.
I am trying to create a sentence in Range ("D3") using cells from Range
("A5:A80").
I need a macro that will copy the contents of any cell that I select in
Range ("A5:A80") and paste it in Range ("D3"). If Range("D3") already
contains some words, it will leave a space at the end of those words and
concatenate the cell content it copied in range ("A5:A80").

Any help would be appreciated. Thanks!

Jay Dean



*** Sent via Developersdex http://www.developersdex.com ***



Jay Dean

CONCATENATING CELL CONTENTS !
 
Gord, thanks a boat load.
It works beautifully!!!

Jay Dean

*** Sent via Developersdex http://www.developersdex.com ***


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com