Results 1 to 8 of 8

Thread: VBA Function To Extract Decimal Numbers

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Administrator Admin's Avatar
    Join Date
    Mar 2011
    Posts
    1,123
    Rep Power
    10
    Hi,

    replace

    Code:
    .Offset(, 5) = Evaluate("if(isnumber(" & x & "),(" & x & "-int(" & x & "))*100," & x & ")")
    with

    Code:
    .Offset(, 5) = Evaluate("if(isnumber(" & x & "),round((" & x & "-int(" & x & ")),2)*100," & x & ")")
    HTH
    Cheers !

    Excel Range to BBCode Table
    Use Social Networking Tools If You Like the Answers !

    Message to Cross Posters

    @ Home - Office 2010/2013/2016 on Win 10 (64 bit); @ Work - Office 2016 on Win 10 (64 bit)

  2. #2
    Senior Member
    Join Date
    Oct 2011
    Posts
    135
    Rep Power
    15
    Hallo

    Wonderful!

    Code:
    Sub Admin()
        Dim x   As String
        With Range("D2:E" & Range("B" & Rows.Count).End(xlUp).Row)
            x = .Address
            .Offset(, 5) = Evaluate("if(isnumber(" & x & "),round((" & x & "-int(" & x & ")),2)*100," & x & ")")
        End With
    End Sub
    This code was looking for, you can teach Evaluate method

Similar Threads

  1. VBA To Extract Email Address From Text
    By dunndealpr in forum Excel Help
    Replies: 43
    Last Post: 06-05-2019, 03:56 PM
  2. Convert a (Possibly) Very Large Positive Decimal Number to Any Base (Up To 36)
    By Rick Rothstein in forum Rick Rothstein's Corner
    Replies: 4
    Last Post: 04-22-2013, 04:52 PM
  3. VBA Code to extract subtotals
    By Howardc in forum Excel Help
    Replies: 2
    Last Post: 12-02-2012, 01:15 PM
  4. Extract numbers from alphanumeric values
    By tushar.tarafdar in forum Excel Help
    Replies: 3
    Last Post: 09-20-2012, 10:16 PM
  5. VBA Code to Extract data
    By Howardc in forum Excel Help
    Replies: 1
    Last Post: 07-24-2012, 11:37 PM

Posting Permissions

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