So here's my issue. I am currently exporting excel files from a website, but due to some issues from the website's end, the exported files have number values with a currency sign before them in a number of columns although the number format of the cells is "General". What I want to do is remove the currency sign before the number values, without having to do it manually each time. Another tricky thing is the fact that the headers of these columns and even the column indexes are not constant. So I was thinking if there's a way to select the cells/columns and remove the currency sign easily using a macro script of some sort that can work on any excel file I am working on. If there is an easier solution that comes to mind, I would also love to hear it.
Here is an example of the problem I'm facing, I would love to just select the number of cells and just set up something that is quick and user-friendly enough for anyone to do to remove the currency signs automatically
The issue seems so simple but for some reason, I can't think of a proper solution. Would appreciate any help :)
CodePudding user response:
Sub RemoveDollarSigns()
Dim cell As Range
For Each cell in Selection
cell.Value = val(replace(replace(cell.Value, "$", ""), ",", "")
Next cell
End Sub
CodePudding user response:
try
Range("K2:M6").Replace What:="$", Replacement:=""
(it's just as quick by hand: just press ctrl h)

