Macro add commas to each cell

Macro add commas to each cell

Excel macros are my new favorite thing, I lie they have been really useful for years and it is only lately I have started to blog the ones I use every day. Today’s task is getting a list of keywords ready to parse to code, by adding a comma to the end of a long spread sheet of values 🙂

The Macro Code – AddCommaAfter()


Sub AddCommaAfter()
Dim cell As Range
For Each cell In Selection
If cell.Value <> "" Then
cell.Value = cell.Value & ","
Else: cell.Value = cell.Value
End If
Next cell
End Sub

If you need to find out more about Macros and how to run them check out a previous posts Excel Macro to Insert Multiple Empty Rows or Convert URLs to Clickable Links In Excel.

Useful Excel Links

  • For more general Excel lessons, tips and tricks check out office.com
  • More Excel Macro info from about.com