![]() |
macro cell add a comma
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. |
macro cell add a comma
maybe something like this:
Sub test() Dim c As Range For Each c In Range("A1:A10").Cells If c.HasFormula Then c.Formula = c.Formula & " & "",""" Else c.Value = c.Value & "," End If Next c End Sub -- Hope that helps. Vergel Adriano "BrianMultilLanguage" wrote: 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. |
macro cell add a comma
Why not just use a formula in another column and PasteSpecial--Values
over top of the existing data once complete? =A1 & "," Vergel Adriano wrote: maybe something like this: Sub test() Dim c As Range For Each c In Range("A1:A10").Cells If c.HasFormula Then c.Formula = c.Formula & " & "",""" Else c.Value = c.Value & "," End If Next c End Sub -- Hope that helps. Vergel Adriano "BrianMultilLanguage" wrote: 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. |
macro cell add a comma
I assumed the OP was looking for a VBA solution because he posted his
question here... it can be done without using VBA, but I guess problems would occur if the cell that needed a comma was the result of a formula. doing PasteSpecial-Values would overwrite the formula. -- Hope that helps. Vergel Adriano "JW" wrote: Why not just use a formula in another column and PasteSpecial--Values over top of the existing data once complete? =A1 & "," Vergel Adriano wrote: maybe something like this: Sub test() Dim c As Range For Each c In Range("A1:A10").Cells If c.HasFormula Then c.Formula = c.Formula & " & "",""" Else c.Value = c.Value & "," End If Next c End Sub -- Hope that helps. Vergel Adriano "BrianMultilLanguage" wrote: 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. |
All times are GMT +1. The time now is 07:41 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com