+ Reply to Thread
Results 1 to 6 of 6

100M = 100,000,000; 100k = 100,000

Hybrid View

  1. #1
    Registered User
    Join Date
    03-30-2004
    Posts
    8

    100M = 100,000,000; 100k = 100,000

    I want to make a macro where you just input 100m and the data automatically converts to 100,000,000, etc. Anyone has some leads? Examples?

  2. #2
    Forum Contributor
    Join Date
    06-10-2004
    Location
    India
    Posts
    1,066
    Enter the following code in the sheet module:

    Private Sub Worksheet_Change(ByVal Target As Range)

    If UCase(Right(Target.Value, 1)) = "M" Then
    Target.Value = Left(Target.Value, Len(Target.Value) - 1) * 1000000
    ElseIf UCase(Right(Target.Value, 1)) = "K" Then
    Target.Value = Left(Target.Value, Len(Target.Value) - 1) * 1000
    End If

    End Sub


    Mangesh

  3. #3
    Alan
    Guest

    Re: 100M = 100,000,000; 100k = 100,000


    "mangesh_yadav"
    <mangesh_yadav.1qnlyd_1118815523.7323@excelforum-nospam.com> wrote in
    message
    news:mangesh_yadav.1qnlyd_1118815523.7323@excelforum-nospam.com...
    >
    > Enter the following code in the sheet module:
    >
    > Private Sub Worksheet_Change(ByVal Target As Range)
    >
    > If UCase(Right(Target.Value, 1)) = "M" Then
    > Target.Value = Left(Target.Value, Len(Target.Value) - 1) *
    > 1000000
    > ElseIf UCase(Right(Target.Value, 1)) = "K" Then
    > Target.Value = Left(Target.Value, Len(Target.Value) - 1) *
    > 1000
    > End If
    >
    > End Sub
    >
    >
    > Mangesh
    >
    >
    > --
    > mangesh_yadav
    > --------------------------------------------------------------------

    ----
    > mangesh_yadav's Profile:

    http://www.excelforum.com/member.php...o&userid=10470
    > View this thread:

    http://www.excelforum.com/showthread...hreadid=379235
    >


    Very cool!

    I would consider putting an error check in there, else if you enter,
    say, "Mum" in a cell it will error out.

    However, still very cool!

    Alan.



  4. #4
    Forum Contributor
    Join Date
    06-10-2004
    Location
    India
    Posts
    1,066
    Hi Alan,

    That depends on the OP (whether to have any validations or not), but yes, it would give an error in that case for sure. Thanks.

    Mangesh



    I would consider putting an error check in there, else if you enter,
    say, "Mum" in a cell it will error out.

    However, still very cool!

    Alan.

  5. #5
    Alan
    Guest

    Re: 100M = 100,000,000; 100k = 100,000

    "jomni" <jomni.1qnj6b_1118811966.1255@excelforum-nospam.com> wrote
    in message news:jomni.1qnj6b_1118811966.1255@excelforum-nospam.com...
    >
    > I want to make a macro where you just input 100m and the data
    > automatically converts to 100,000,000, etc. Anyone has some leads?
    > Examples?
    >


    Hi Jomni,

    Shouldn't be too difficult.

    I would suggest you use a worksheet_change event to trigger a check on
    the taget cell (or cells) and pattern match where the entry is a text
    string of
    the form "[N]m" where [N] is one or more numeric digits.

    HTH,

    Alan.




  6. #6
    Dr. Solver
    Guest

    RE: 100M = 100,000,000; 100k = 100,000

    Dear Jomni.
    The maximum characters # is 15 and it accurate; example, if you inter
    123,123,123,123,123,123 that’s 18 characters, excels will save it as 15
    character only as: 123,123,123,123,123,000.But that rarely happen.

    "jomni" wrote:

    >
    > I want to make a macro where you just input 100m and the data
    > automatically converts to 100,000,000, etc. Anyone has some leads?
    > Examples?
    >
    >
    > --
    > jomni
    > ------------------------------------------------------------------------
    > jomni's Profile: http://www.excelforum.com/member.php...fo&userid=7744
    > View this thread: http://www.excelforum.com/showthread...hreadid=379235
    >
    >


+ 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