Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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) |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I add an item with comma in the list of data validation | Excel Discussion (Misc queries) | |||
Creating a column with just data before comma in another column | Excel Worksheet Functions | |||
enter item code in one column, automatically get description in ne | Excel Worksheet Functions | |||
Selecting Menu Item by VBA Code | Excel Programming | |||
Select an item in a listbox using code | Excel Programming |