View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Greg Wilson[_4_] Greg Wilson[_4_] is offline
external usenet poster
 
Posts: 218
Default 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/

.