How to I put a comma in between each column item from this code
This code combines all the data into one string. How can I parse it with a
comma in between each column entry. Also would there be a way to add comments to each column right before the comma?? Thanks Set x = CreateObject("Word.Application") x.Documents.Add x.Visible = True For Each cl In Selection n = n & CStr(cl.Value) Next x.Selection.TypeText CStr(n) |
How to I put a comma in between each column item from this code
On Mon, 7 Mar 2005 20:51:02 -0800, "Adam"
wrote: This code combines all the data into one string. How can I parse it with a comma in between each column entry. Also would there be a way to add comments to each column right before the comma?? Thanks Set x = CreateObject("Word.Application") x.Documents.Add x.Visible = True For Each cl In Selection n = n & CStr(cl.Value) Next x.Selection.TypeText CStr(n) Here's one way: ======================= Sub foo() Dim temp() Dim n As String Dim c As Range Dim i As Long ReDim temp(Selection.Count - 1) For Each c In Selection temp(i) = CStr(c.Value) i = i + 1 Next c n = Join(temp, ",") Debug.Print n End Sub ========================= --ron |
All times are GMT +1. The time now is 05:35 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com