From: Fred Kruger on 2 Apr 2010 04:29 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.
From: Graham Mayor on 2 Apr 2010 05:28 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 My web site www.gmayor.com Word MVP web site http://word.mvps.org <>>< ><<> ><<> <>>< ><<> <>>< <>><<> "Fred Kruger" <FredKruger(a)discussions.microsoft.com> wrote in message news:DA68E82E-39FF-449A-AEC0-58E740A9DE9D(a)microsoft.com... >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.
From: macropod on 2 Apr 2010 06:50 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" <FredKruger(a)discussions.microsoft.com> wrote in message news:DA68E82E-39FF-449A-AEC0-58E740A9DE9D(a)microsoft.com... >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.
From: Fred Kruger on 2 Apr 2010 15:55 Macrprod graham Thanks for this Fred "macropod" wrote: > 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" <FredKruger(a)discussions.microsoft.com> wrote in message news:DA68E82E-39FF-449A-AEC0-58E740A9DE9D(a)microsoft.com... > >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. > . >
|
Pages: 1 Prev: Keeping Lines Together (Word 2007 VBA) Next: How to get the text of each selection? |