Reading a Range

  • Thread starter Thread starter Pablo
  • Start date Start date
P

Pablo

I have a range of cells, column that I would like to take
and place in a single cell separated by a comma. Below
is the result I would like to see.

23,43,589,432,12...

23
43
589
432
12
443
898
....

Any help would be greatly appreciated.
 
For Each cell In Selection
sVal = sVal & "," & cell.Value
Next cell

Range("A1").Value = Right(sVal,Len(sVal)-1)

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Pablo,

Try some code like the following

Sub AAA()
Dim S As String
Dim Rng As Range
For Each Rng In Range("A1:A10")
If Rng.Text <> "" Then
S = S & Rng.Text & ","
End If
Next Rng
S = Left$(S, Len(S) - 1)
Debug.Print S
End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 

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

Back
Top