ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Merging cells text (https://www.excelbanter.com/excel-programming/307390-merging-cells-text.html)

gdselva[_2_]

Merging cells text
 
Hi,

I have one question,


Input:

A1 contains: Selvam K
C1 contains: Frank
D10 contains: gdselva
d1:d5 contains: 10, 20, 30, 40, 50


Output:
A1 contains:
Selvam K, Frank, gdselva, 10, 20, 30, 40, 50


The selection should be using Ctrl + a1, c1, d10, d1:d5 this sequence
The output should be merged all the cell values and display into th
first selected cell.


Can you help me I to do it.


Regards,

Selvam

--
Message posted from http://www.ExcelForum.com


DavidC[_2_]

Merging cells text
 
You will need the data in A1 to be held elsewhere say b1.
Then A1 will have the following formula:

=B1&", "&C1&", "&D10&", "&D1&", "&D2", "&D3", "&D4", "&D5

You will need to make sure there is a space after the
comma otherwise it will all run together as one long group
of letters and numbers.

BOL
David C
-----Original Message-----
Hi,

I have one question,


Input:

A1 contains: Selvam K
C1 contains: Frank
D10 contains: gdselva
d1:d5 contains: 10, 20, 30, 40, 50


Output:
A1 contains:
Selvam K, Frank, gdselva, 10, 20, 30, 40, 50


The selection should be using Ctrl + a1, c1, d10, d1:d5

this sequence.
The output should be merged all the cell values and

display into the
first selected cell.


Can you help me I to do it.


Regards,

Selvam K


---
Message posted from http://www.ExcelForum.com/

.


Greg Wilson[_4_]

Merging cells text
 
Try this:

Sub MergeVals()
Dim c As Range, rng As Range
Dim txt As String
Set rng = Selection
txt = rng(1)
For Each c In rng
If Intersect(c, rng(1)) Is Nothing Then _
txt = txt & ", " & c
c = ""
Next
rng(1) = txt
End Sub

Regards,
Greg

-----Original Message-----
Hi,

I have one question,


Input:

A1 contains: Selvam K
C1 contains: Frank
D10 contains: gdselva
d1:d5 contains: 10, 20, 30, 40, 50


Output:
A1 contains:
Selvam K, Frank, gdselva, 10, 20, 30, 40, 50


The selection should be using Ctrl + a1, c1, d10, d1:d5

this sequence.
The output should be merged all the cell values and

display into the
first selected cell.


Can you help me I to do it.


Regards,

Selvam K


---
Message posted from http://www.ExcelForum.com/

.



All times are GMT +1. The time now is 09:13 AM.

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