Copying cell contents from many cells and pasting into one cell

M

MDN

Hello

I'd like to copy the contents from a group of cells and then paste all of
those contents into one cell on a different worksheet. How can I do this?
 
P

Pete_UK

I think you would need a formula, something like:

=Sheet1!A1&Sheet1!A2&Sheet1!A3 etc.

Hope this helps.

Pete
 
G

Gord Dibben

You could just combine using a formula on destination sheet.

=Sheet1!A1 & Sheet1!B1 and Sheet1!C1 etc.

Or a User Defined Function.......................

Function ConCatRange(CellBlock As Range) As String
Dim Cell As Range
Dim sbuf As String
For Each Cell In CellBlock
If Len(Cell.text) > 0 Then sbuf = sbuf & Cell.text & " "
Next
ConCatRange = Left(sbuf, Len(sbuf) - 1)
End Function

=Sheet1!(A1:A10)

Or a macro.............................

Sub ConCat_Cells()
Dim x As Range
Dim y As Range
Dim z As Range
Dim w As String
Dim sbuf As String
On Error GoTo endit
w = InputBox("Enter the Type of De-limiter Desired")
Set z = Application.InputBox("Select Destination Cell", _
"Destination Cell", , , , , , 8)
Application.SendKeys "+{F8}"
Set x = Application.InputBox("Select Cells, Contiguous or Non-Contiguous", _
"Cells Selection", , , , , , 8)
For Each y In x
If Len(y.text) > 0 Then sbuf = sbuf & y.text & w
Next
z = Left(sbuf, Len(sbuf) - Len(w))
Exit Sub
endit:
MsgBox "Nothing Selected. Please try again."
End Sub


Gord Dibben MS Excel MVP
 
M

Marcelo

try to use concatenate
assuming that you have one data base

a b

1 Many to
2 Things do
3
4 =a1&" "&a2&" "&b1&" "&b2

hth


--
regards from Brazil
Thanks in advance for your feedback.
Marcelo



"MDN" escreveu:
 
M

MDN

Thank you. Is is possible to Concatenate a large range of cells ? I have 75
cells that I want to put together. Does that mean I'll have to enter each
number into the formula or is there a way to do a range?
 
G

Gord Dibben

Read my response.


Gord Dibben MS Excel MVP

Thank you. Is is possible to Concatenate a large range of cells ? I have 75
cells that I want to put together. Does that mean I'll have to enter each
number into the formula or is there a way to do a range?
 
M

MDN

Thanks!

Gord Dibben said:
You could just combine using a formula on destination sheet.

=Sheet1!A1 & Sheet1!B1 and Sheet1!C1 etc.

Or a User Defined Function.......................

Function ConCatRange(CellBlock As Range) As String
Dim Cell As Range
Dim sbuf As String
For Each Cell In CellBlock
If Len(Cell.text) > 0 Then sbuf = sbuf & Cell.text & " "
Next
ConCatRange = Left(sbuf, Len(sbuf) - 1)
End Function

=Sheet1!(A1:A10)

Or a macro.............................

Sub ConCat_Cells()
Dim x As Range
Dim y As Range
Dim z As Range
Dim w As String
Dim sbuf As String
On Error GoTo endit
w = InputBox("Enter the Type of De-limiter Desired")
Set z = Application.InputBox("Select Destination Cell", _
"Destination Cell", , , , , , 8)
Application.SendKeys "+{F8}"
Set x = Application.InputBox("Select Cells, Contiguous or Non-Contiguous", _
"Cells Selection", , , , , , 8)
For Each y In x
If Len(y.text) > 0 Then sbuf = sbuf & y.text & w
Next
z = Left(sbuf, Len(sbuf) - Len(w))
Exit Sub
endit:
MsgBox "Nothing Selected. Please try again."
End Sub


Gord Dibben MS Excel MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top