Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default dot / comma and string to double conversion

I'm italian and we use the comma "," for decimal (es: 123,14‚¬). So excel
works with commas, but for other reason I need to input the data in the user
form with the dot (123.45‚¬). I've written a function to convert this input to
letters (CENTOVENTITRE/45, in italian of course) but it does work only if I
use the comma.

here it is:
Function EURO_TO_ITALIAN(ByVal N As String) As String

Dim TheInteger As Long
TheInteger = n
If TheInteger n Then TheInteger = TheInteger - 1
Dim TheRest As Long
TheRest = (n - TheInteger) * 100
If TheRest < 10 Then
EURO_TO_ITALIAN = INTEGER_TO_ITALIAN(TheInteger) & "/0" & TheRest
ElseIf TheRest = 10 Then
EURO_TO_ITALIAN = INTEGER_TO_ITALIAN(TheInteger) & "/" & TheRest
End If

End Function

euro_to_italian is the function that writes the letters, and that one uses
only integers (long) so has no problem

Do you have any solution? Maybe a way to substitute the dot with a comma in
the string variable would work fine.

bye
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,339
Default dot / comma and string to double conversion



N = Replace(N, ",", ".")
TheInteger = N

"snaggy^^" wrote:

I'm italian and we use the comma "," for decimal (es: 123,14‚¬). So excel
works with commas, but for other reason I need to input the data in the user
form with the dot (123.45‚¬). I've written a function to convert this input to
letters (CENTOVENTITRE/45, in italian of course) but it does work only if I
use the comma.

here it is:
Function EURO_TO_ITALIAN(ByVal N As String) As String

Dim TheInteger As Long
TheInteger = n
If TheInteger n Then TheInteger = TheInteger - 1
Dim TheRest As Long
TheRest = (n - TheInteger) * 100
If TheRest < 10 Then
EURO_TO_ITALIAN = INTEGER_TO_ITALIAN(TheInteger) & "/0" & TheRest
ElseIf TheRest = 10 Then
EURO_TO_ITALIAN = INTEGER_TO_ITALIAN(TheInteger) & "/" & TheRest
End If

End Function

euro_to_italian is the function that writes the letters, and that one uses
only integers (long) so has no problem

Do you have any solution? Maybe a way to substitute the dot with a comma in
the string variable would work fine.

bye

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default dot / comma and string to double conversion

What a fantastic command!! Thank you so much, i really needed this one
becouse i'm gonna give my program in 2 hours!
thanks
Reply
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
text string separated by comma Atishoo Excel Discussion (Misc queries) 6 February 12th 09 05:19 PM
test text string for a comma (,) JR Hester Excel Discussion (Misc queries) 3 June 24th 08 04:14 AM
thousand separator conversion from dot to comma Spike Excel Discussion (Misc queries) 10 January 31st 06 09:07 PM
Macro to find a comma in a string Chuck[_11_] Excel Programming 8 August 24th 05 03:23 AM
how do I create comma and double quote delimited file mikeb Excel Discussion (Misc queries) 1 November 29th 04 10:01 PM


All times are GMT +1. The time now is 01:45 AM.

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"