Want to become an expert in VBA? So this is the right place for you. This blog mainly focus on teaching how to apply Visual Basic for Microsoft Excel. So improve the functionality of your excel workbooks with the aid of this blog. Also ask any questions you have regarding MS Excel and applying VBA. We are happy to assist you.

VBA Fix Function

Today I'm going to explain you another very useful VBA function. It is Fix function. You can use this function to get the integer part of a numerical value. For an example, if you parse value 102.5 to the Fix function it will return 102

Here below is a sample subroutine from which you can get a clear idea about how this function works.

Sub FixFunctionExample()

Dim SampleValues(4) As Double

SampleValues(0) = 0.25
SampleValues(1) = 5.78
SampleValues(2) = 100.5
SampleValues(3) = -25.8
SampleValues(4) = -30.2

For i = LBound(SampleValues) To UBound(SampleValues)
Debug.Print Fix(SampleValues(i))
Next i

End Sub

If you run the above code, you will get following result in the intermediate window.

0
5
100
-25
-30

Contact Form

Name

Email *

Message *