Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to use Whole function 1

Status
Not open for further replies.

vba317

Programmer
Mar 5, 2009
708
US
I was hoping to get some advice on how to use a whole function.

Code:
Public Function IsWhole(ByVal Number As Variant) As Boolean

    If InStr(1, CStr(Number), ".") Then
        IsWhole = False
    Else
        IsWhole = True
    End If
        
End Function

I am trying to use this function by the following code

If LowLoopCount = LowLoopCount/8 isWhole Then LowLoopEnd = LowLoopEnd + 8

I know this is wrong beause I get a compile error. I am trying to run a loop where the upper range is 8. So I figured if I increment the upper end of the loop by 8 only when the the loop is divided by 8 is a whole number. Any help would be appreciated.

 
try

If LowLoopCount = IsWhole(LowLoopCount / 8) Then
LowLoopEnd = LowLoopEnd + 8



HTH << MaZeWorX >> "I have not failed I have only found ten thousand ways that don't work" <<Edison>>
 


Your logic is not correct!
Code:
If LowLoopCount / 8 = INT(LowLoopCount / 8) Then

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Another simple way:
Code:
If LowLoopCount Mod 8 = 0 Then

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top