07-21-2020 09:20 AM
I have a column in my spreadsheet that have values with DOT instead of COMMA-sign.
I created a public function like this:
Public Function fixakomma(rng As String)
fixacomma = SUBSTITUTE(rng, ".", ",")
End Function
No error in Visual Basic, but when I type in an empty cell ( P6 ) beside my column to execute the function
=fixakomma(M6)
where the column name is M and the cell row in the column is 6
I immediately gets a VALUE error message (in swedish #VÅRDEFEL! ).
If I type the same in an empty cell ( R6 ) =SUBSTITUTE(M6;".";",") I get the DOT exchanged to a COMMA-sign.
My reason for the Public Function, was to execute one cell and then drag this down in the column, to get the rest converted
What is my problem ?
Douglas
07-21-2020 10:03 AM
@DouglasJB Did you consider "Find & Replace" or "Text-to-columns"? Is there a particular reason why you want to use a User Defined Function, just to substitute a point for a comma?
07-21-2020 11:32 AM
I got the column in a table, and I wanted to use the Sum feature to summarize the values.
Earlier the column had a COMMMA-sign in that column, so it was easy to summarize, but from now on they will have a DOT, so since it is just this column I am interested in, I thought it would be easier to just use SUBSTITUTE, and inside a function, would allow me to select just this column.,
DouglasJB
07-21-2020 11:34 AM