Help using Macro to add a comma after everyline

Anty506

New Member
Joined
Mar 5, 2009
Messages
4
I have a list that I copied and paste into excel.

Its just column A and the extensions run together.... here is an ex

.c
.c00
.c01
.c01
.c02
.c2d
.c4
.c4d
.ca
.cab

What I need is a comma after each one so it will look like this.

.c,
.c00,
.c01,
.c01,
.c02,
.c2d,
.c4,
.c4d,
.ca,
.cab,

I have very long list of extensions and I need to have the comma after everyone so I can copy and paste it right into my php script :)

Thanks!
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
Code:
Sub test()
Dim c As Range
For Each c In Range("A1:A" & Range("A" & Rows.Count).End(xlUp).Row)
    c = c & ","
Next
End Sub
 
Upvote 0
Code:
Sub test()
Dim c As Range
For Each c In Range("A1:A" & Range("A" & Rows.Count).End(xlUp).Row)
    c = c & ","
Next
End Sub

Thanks for the reply, but that will only work for rows that start with C right?

I am starting with C but going all the way to Z extensions.

How would I format that Macro for this?
 
Upvote 0
The c has nothing to do with your text values, it is a range object variable name.


My code as written is for values in Column A, and will put a comma after every entry in the column.
 
Upvote 0

Forum statistics

Threads
1,215,054
Messages
6,122,893
Members
449,097
Latest member
dbomb1414

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top