VBA Int ve Fix işlevleri bir sayının tamsayı kısmını döndürür.
Int(sayı)
Fix(sayı)
Farklı türdeki sayısal değerleri dönüştürmek için Int ve Fix işlevlerini kullanmak; bu, negatif değerlerle uğraşırken farkı daha iyi anlamanıza da yardımcı olur:
Sub IntFixExample()
MsgBox Int(1) 'İade: 1
MsgBox Fix(1) 'İade: 1
MsgBox Int(-1) 'İade: -1
MsgBox Fix(-1) 'İade: -1
MsgBox Int(2.9) 'İade: 2
MsgBox Fix(2.9) 'İade: 2
MsgBox Int(-2.9) 'İade: -3
MsgBox Fix(-2.9) 'İade: -2
MsgBox Int(4.5) 'İade: 4
MsgBox Fix(4.5) 'İade: 4
MsgBox Int(-4.5) 'İade: -5
MsgBox Fix(-4.5) 'İade: -4
MsgBox Int(0.424) 'İade: 0
MsgBox Fix(0.424) 'İade: 0
MsgBox Int("13") 'İade: 13
MsgBox Fix("13") 'İade: 13
MsgBox Int("-4.5") 'İade: -5
MsgBox Fix("-4.5") 'İade: -4
MsgBox Int(True) 'İade: -1
MsgBox Fix(True) 'İade: -1
MsgBox Int(False) 'İade: 0
MsgBox Fix(False) 'İade: 0
End Sub