metazone63...,
Bisa gunakan fungsi seperti dibawah ini:
Function genap(X) As Boolean
If ((X Mod 2) = 0) Then
genap = True
Else
genap = False
End If
End Function
Public Function Floor(ByVal X As Double, Optional ByVal Factor As Double = 1) As Double
' X is the value you want to round
' is the multiple to which you want to round
Floor = Int(X / Factor) * Factor
End Function
Private Sub Command2_Click()
Dim aa, ab As Variant
If Text0 <> "" Then
If IsNumeric(Text0) Then
aa = Text0 - Int(Text0)
If Format(aa, "#,###.0") = 0.5 Then
ab = Text0 - 0.5
If genap(ab) Then
ab = Round(Text0) + 1
Else
ab = Floor(Text0)
End If
Else
ab = Round(Text0)
End If
MsgBox ab
Else
MsgBox "harus angka"
Text0 = ""
Text0.SetFocus
End If
Else
MsgBox "Text0 harus berisi"
Text0.SetFocus
End If
End Sub
Semoga bisa membantu dan memberi semangat.
Hariyanto (Surabaya)
--------------------------------------------
On Fri, 16/5/14, metazone63@yahoo.com [belajar-access] <belajar-access@yahoogroups.com> wrote:
Subject: [belajar-access] Re: (Tidak ada yg bantu) Pembulatan ke Bilangan Ganjil
To: belajar-access@yahoogroups.com
Date: Friday, 16 May, 2014, 7:42 PM
Kok tidak ada yang jawab. Apa tidak ada bisa atau
memang tidak ada solusi nya......
| Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (3) |
Tidak ada komentar:
Posting Komentar