Thread: Comma to period
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Freddie[_3_] Freddie[_3_] is offline
external usenet poster
 
Posts: 1
Default Comma to period

Dear clever folks!

I'm living in Sweden where we use komma instead of period as seperator
for the decimal part in numbers.
This is no good since all (almost) programes uses period as a
seperator.
I'm doing some number manipulations in Excel and at the end I'm
suppose to export my data as a text file, but Excel exports it with a
komma instead of period, which my next programe cannot interpret.
I know that changing my regional settings within Windows solves this
problem, but I don't have administrative privilgies on the computer so
that is of no good.

I have done a basic macro that looks like this:

Sub ConvertCommaToPeriod()

Worksheets(2).Columns("B").Replace _
What:=",", Replacement:=".", LookAt:=xlPart ', _
'SearchOrder:=xlByColumns ', MatchCase:=True

End Sub

This works well for data that looks like this:

'1234,5678 (notice the apostrophe in the beginning!)

But fails to recognise

1234,5678 (cell formated as text)

What is up with this?

I could of course insert an apostrophe in the beginning of every cell,
but surely there must be a better way?

Best regards
Freddie