Thread: Multiples
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Greg Glynn[_2_] Greg Glynn[_2_] is offline
external usenet poster
 
Posts: 1
Default Multiples

Terry

I haven't tested this by try looking at the MOD function (modulus)

If the MOD of a number divided by another number is ZERO then it divides
evenly (therefore its a mutliple) so I'm thinking a simple FOR/NEXT loop
counting from 1 up to the TEST number should provide you with all the
multiples.

Something like:

FOR X = 1 TO TESTNUM
IF MOD(TESTNUM,X)=0 then success
NEXT X

Greg

wrote in message
om...
Is there a way function in VBA that allows you to calcualte the
multiple of a number. That is, if the variable = 36, I want to
calculate all nine multiples:

M1=1 (1*36=36)
M2=2 (2*18=36)
M3=3 (3*12=36)
M4=4
M5=6
M6=9
M7=12
M8=18
M9=36

Thanks

TS