+ Reply to Thread
Results 1 to 2 of 2

Code compatibility issue

  1. #1
    Registered User
    Join Date
    10-14-2005
    Posts
    8

    Code compatibility issue

    I am facing problem in making code compatible with countries other than united states

    If locale is US :- The value of string variable assigned to Single variable correctly

    Dim my_num_st As String
    Dim my_con_single As Single

    my_num_st = "0.8"
    my_con_single = CSng(my_num_st)

    MsgBox (my_con_single) :- Display 0.8 (Correct)


    If locale is Europe :- The value of string variable not assigned to Single variable correctly

    Dim my_num_st As String
    Dim my_con_single As Single

    my_num_st = "0.8"
    my_con_single = CSng(my_num_st)

    MsgBox (my_con_single) :- Display 8 (Incorrect)

    Please help....

  2. #2
    Tom Ogilvy
    Guest

    Re: Code compatibility issue


    Dim my_num_st As String
    Dim my_con_single As Single
    Dim dec_sep as String
    dec_sep = Application.International(xlDecimalSeparator)
    my_num_st = "0.8"
    my_num_st = replace(my_num_st,".",dec_sep)
    my_con_single = CSng(my_num_st)

    MsgBox (my_con_single)

    --
    Regrards,
    Tom Ogilvy


    "iamrajy" <[email protected]> wrote in
    message news:[email protected]...
    >
    > I am facing problem in making code compatible with countries other than
    > united states
    >
    > If locale is US :- The value of string variable assigned to Single
    > variable correctly
    >
    > Dim my_num_st As String
    > Dim my_con_single As Single
    >
    > my_num_st = "0.8"
    > my_con_single = CSng(my_num_st)
    >
    > MsgBox (my_con_single) :- Display 0.8 (Correct)
    >
    >
    > If locale is Europe :- The value of string variable not assigned to
    > Single variable correctly
    >
    > Dim my_num_st As String
    > Dim my_con_single As Single
    >
    > my_num_st = "0.8"
    > my_con_single = CSng(my_num_st)
    >
    > MsgBox (my_con_single) :- Display 8 (Incorrect)
    >
    > Please help....
    >
    >
    > --
    > iamrajy
    > ------------------------------------------------------------------------
    > iamrajy's Profile:

    http://www.excelforum.com/member.php...o&userid=28117
    > View this thread: http://www.excelforum.com/showthread...hreadid=476872
    >




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1