LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,651
Default VBA - How to change the decimal sign

On Wed, 9 Mar 2005 23:00:25 +0100, "gilgil" wrote:

on the Web in Excel

1.90 ------------------ 0,10417
2.00 ------------------ 2.00 (with digit)
1.80 ------------------ 0,09722

Thanks.

--
gilgil


Thank you. I see what is happening now. Your system is interpreting the
decimal as a time separator. So 1.90 gets interpreted as 1 hr 90 minutes and
0,10417 represents 0230 (1 hr 90 min is the same as 2 hr 30 min). Excel stores
time as fractions of a day.

I know of no way to derive the original 1.90 from 0,10417 since other entries
could have resulted in the latter (e.g. 2.30 would give the same number).

Some suggestions:

1. Change your windows regional settings to a compatible version before doing
the import, then change them back.

2. If you are doing a copy/paste to import the data, you might try
preformatting as text. If that works, you could then insert a helper column;
use the SUBSTITUTE worksheet function (=--SUBSTITUTE(A1,".",","); copy/paste
values and delete the superfluous column. You may have to replace the comma
separators in the function arguments with whatever is appropriate for your
locale.

3. Preformat as text, and then run a macro on the data to do the substitution.

4. If preformatting as text does not work, then you will need a VB routine to
process the data before importing it into Excel.

For choice 3, the macro might be something like:

=====================
Sub foo()
Dim c As Range
Dim aoi As Range

Set aoi = Range("A1:A10")

For Each c In aoi
c.Value = Val(Replace(c.Value, ".", ","))
c.NumberFormat = "General"
Next c

End Sub
=======================


--ron
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Decimal Place goes crazy when using the "&" Sign. spreadsheetlady Excel Discussion (Misc queries) 4 April 26th 10 12:37 AM
Plus sign after decimal??? Keensie Excel Discussion (Misc queries) 0 November 21st 07 02:55 PM
how can i change dollar sign to rupee sign in sales invoice vishal kohli Excel Discussion (Misc queries) 3 May 10th 07 02:06 PM
can I change the $ sign to a £ sign in an MS template? tony Excel Worksheet Functions 1 January 2nd 06 06:31 PM
How do you change the sign (e.g. +3 to -3 OR -3 to +3) [email protected] Excel Discussion (Misc queries) 3 November 15th 05 07:50 PM


All times are GMT +1. The time now is 10:19 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"