Whole Numbers

F

Fred Kruger

I want to determine if a number entered when divided by 6 is whole i.e if
some one enter 12 then it will be 2 whereas if they enter 13 the answer is
2.166667

what I wish to achieve is I have a document which will allow 6 entries but
if the user wants to put more than 6 entries in the further pages need to be
entered so to determine how many further pages need to be entered mean the
entered if when divided by 6 is whole is the number need but if its a greater
than a whole number then a further page needs adding if this makes sense.
 
G

Graham Mayor

Investigate the MOD operator
e.g.

Dim sText As String
sText = InputBox("Enter a number")
If sText Mod 6 = 0 Then
MsgBox "Number is exactly divisible by 6"
Else
MsgBox "Number is not exactly divisible by 6"
End If


--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
M

macropod

Hi Fred,

Try something based on:

Sub Test()
Dim x, y, z as integer
x = InputBox("How many entries?")
y = 6
z = -Int(-x / y)
MsgBox "The required number of pages is " & z
End Sub
 
F

Fred Kruger

Macrprod graham

Thanks for this

Fred

macropod said:
Hi Fred,

Try something based on:

Sub Test()
Dim x, y, z as integer
x = InputBox("How many entries?")
y = 6
z = -Int(-x / y)
MsgBox "The required number of pages is " & z
End Sub

--
Cheers
macropod
[Microsoft MVP - Word]


Fred Kruger said:
I want to determine if a number entered when divided by 6 is whole i.e if
some one enter 12 then it will be 2 whereas if they enter 13 the answer is
2.166667

what I wish to achieve is I have a document which will allow 6 entries but
if the user wants to put more than 6 entries in the further pages need to be
entered so to determine how many further pages need to be entered mean the
entered if when divided by 6 is whole is the number need but if its a greater
than a whole number then a further page needs adding if this makes sense.
.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top