VBA
Discuss AutoCAD ActiveX and VBA (Visual Basic for Applications) questions here.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Determining if string is evenly divisble by 5

4 REPLIES 4
Reply
Message 1 of 5
Anonymous
141 Views, 4 Replies

Determining if string is evenly divisble by 5

Hi,

I'm writing a vba macro in A2K and I need to determine if a string is
divisble by 5. I realize I will need to convert the string to an integer
(the string values are integers) using CInt (I think that's the one) before
attemtping this. Once I have an integer assigned to my variable TMP, how do
I figure out if it's divisble by 5 (or any other number I choose)?

Thanks,
GC
4 REPLIES 4
Message 2 of 5
Anonymous
in reply to: Anonymous

look at Mod function

"George C." wrote in message
news:797AA8EFA3583C697FE83FC655CB1757@in.WebX.maYIadrTaRb...
> Hi,
>
> I'm writing a vba macro in A2K and I need to determine if a string is
> divisble by 5. I realize I will need to convert the string to
Message 3 of 5
Anonymous
in reply to: Anonymous

I looked in AutoCAD's online help and I couldn't make sense of its
explanation. Can anyone please provide an example of this function?

Thanks,
GC


"Mark Propst" wrote in message
news:AA63CFB75C91B863C1F8A7AE0AC71890@in.WebX.maYIadrTaRb...
>
> look at Mod function
>
> "George C." wrote in message
> news:797AA8EFA3583C697FE83FC655CB1757@in.WebX.maYIadrTaRb...
> > Hi,
> >
> > I'm writing a vba macro in A2K and I need to determine if a string is
> > divisble by 5. I realize I will need to convert the string to
>
>
Message 4 of 5
Anonymous
in reply to: Anonymous

This function will return true if value is divisible by 5.
David
;
(defun modulus (value /)
(not (/= 0 (rem value 5)))
)
;
;sample:
; (modulus 13) returns nil
; (modulus 10) returns T
;

"George C." wrote in message
news:C4BA1B611105F1C328CE5FF38F4BF545@in.WebX.maYIadrTaRb...
> I looked in AutoCAD's online help and I couldn't make sense of its
> explanation. Can anyone please provide an example of this function?
>
> Thanks,
> GC
>
>
> "Mark Propst" wrote in message
> news:AA63CFB75C91B863C1F8A7AE0AC71890@in.WebX.maYIadrTaRb...
> >
> > look at Mod function
> >
> > "George C." wrote in message
> > news:797AA8EFA3583C697FE83FC655CB1757@in.WebX.maYIadrTaRb...
> > > Hi,
> > >
> > > I'm writing a vba macro in A2K and I need to determine if a string is
> > > divisble by 5. I realize I will need to convert the string to
> >
> >
>
>
Message 5 of 5
Anonymous
in reply to: Anonymous

if 10 mod 5 = 0 then
Debug.Print "Holy Cow Batman was That a Flying squirrel that just Flew by?"
end if

hth
Mark

"George C." wrote in message
news:C4BA1B611105F1C328CE5FF38F4BF545@in.WebX.maYIadrTaRb...
> I looked in AutoCAD's online help and I couldn't make sense of its
> explanation. Can anyone please provide an example of this function?
>
> Thanks,
> GC
>

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost