Results 1 to 2 of 2

Thread: Help with long numbers ...

  1. #1

    Thread Starter
    Evil Genius alex_read's Avatar
    Join Date
    May 2000
    Location
    Espoo, Finland
    Posts
    5,538

    Help with long numbers ...

    Hi all, don't normally do this, but can anyone shed some light on this one for me please?

    http://209.120.143.185/showthread.ph...hreadid=181256

    Please rate this post if it was useful for you!
    Please try to search before creating a new post,
    Please format code using [ code ][ /code ], and
    Post sample code, error details & problem details

  2. #2
    Hyperactive Member
    Join Date
    May 2002
    Location
    Chicago
    Posts
    271
    This should help:
    Code:
    Private Sub Command1_Click()
      Dim TempNo As Double
      TempNo = ModMe(9, 2)
      MsgBox TempNo
    End Sub
    
    Private Function ModMe(fdNumber As Double, fdDivisor As Double) As Double
      Dim fNum As Variant
      If fdDivisor = 0 Then
        MsgBox "Divisor must be greater than 0"
        Exit Function
      End If
      If fdNumber < fdDivisor Then
        ModMe = fdNumber
        Exit Function
      End If
      fNum = fdNumber / fdDivisor
      If InStr(1, fNum, ".") Then
        fNum = CDbl(Right(fNum, Len(fNum) - (InStr(fNum, ".") - 1)))
        fNum = fNum * fdDivisor
        ModMe = Round(fNum, 0)
      Else
        ModMe = 0
      End If
    End Function
    Last edited by JohnVB6; Jun 24th, 2002 at 05:06 AM.
    Sometimes what you're looking for is exactly where you left it.

Posting Permissions

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



Click Here to Expand Forum to Full Width