macro to add a comma

  • Thread starter BrianMultilLanguage
  • Start date
B

BrianMultilLanguage

I need to add a comma at the end of every cell entry in one column and am
not having any success doing it.
It's gotta be easy for someone.
Help.
 
R

Rodrigo Ferreira

BrianMultilLanguage said:
I need to add a comma at the end of every cell entry in one column
and am not having any success doing it. It's gotta be easy for
someone. Help.


If the column that you want to add a comma is A, try to put the formula
in column B

=A1 & ","

Copy the formula to others cells in the same column (B)
 
S

Sandy Mann

Rodrigo,

That will add commas to empty cells.

I suggest highlighting the range to be chabged and running:

Sub AddComma()
For Each cell In Selection
If cell.Value <> "" Then
cell.Value = cell.Value & ","
End If
Next cell

End Sub

--
HTH

Sandy
In Perth, the ancient capital of Scotland
and the crowning place of kings

(e-mail address removed)
Replace @mailinator.com with @tiscali.co.uk
 
B

BrianMultilLanguage

Terriffic.
Thanks. Worked after I selected the range.


Sandy Mann said:
Rodrigo,

That will add commas to empty cells.

I suggest highlighting the range to be chabged and running:

Sub AddComma()
For Each cell In Selection
If cell.Value <> "" Then
cell.Value = cell.Value & ","
End If
Next cell

End Sub

--
HTH

Sandy
In Perth, the ancient capital of Scotland
and the crowning place of kings

(e-mail address removed)
Replace @mailinator.com with @tiscali.co.uk
 
S

Sandy Mann

I'm glad that it worked for you, thank for the feedback.

--
Regards,

Sandy
In Perth, the ancient capital of Scotland
and the crowning place of kings

(e-mail address removed)
Replace @mailinator.com with @tiscali.co.uk


BrianMultilLanguage said:
Terriffic.
Thanks. Worked after I selected the range.
 

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

Top