I will try to comment it a bit more and as MrShickadance said, make it cleaner.
Code:' Declare our variables Dim X As Integer Dim IsWhole As Boolean Dim DivideIt As Integer ' Loop until we get a good number Do While Not IsWhole = True DoEvents ' Let Windows do other tasks Randomize ' Create a Random seed value X = Int(Rnd * 360) 'Generate a vlue from 0-360 If X >= 24 Then 'If X is equal to or greater than 24 DivideIt = 360 / X ' Store 360 / X in a variable 'CInt converts the number to a whole number. So this 'statement will subtract DivideIt from DivideIt when 'it is rounded as a whole number. If DivideIt has 'some decimals, they would be left over so your 'answer will not equal 0, therefor, we do not accept it IsWhole = (DivideIt - CInt(DivideIt)) = 0 End If Loop Label1.Caption = X




Reply With Quote