This is the complete answer
Try this one on for size...guaranteed to work every time! (at least with the number 11) :)
Paste the following into a forms code window (or change Form_Load to Main and put it in a basic module):
Code:
Option Explicit
Private Sub Form_Load()
Dim Number As Long
Dim Remainder As Long
Dim Result As Long
Dim Answer As String
Number = CLng(InputBox("Enter a number, please:", "FallnWrld"))
Do
Remainder = GetRemainder(Number, Result)
Number = Result
Answer = CStr(Remainder) & Answer
Loop While Result > 0
MsgBox "Answer = " & Answer
Unload Me
End Sub
Private Function GetRemainder(Number As Long, Result As Long) As Long
Result = CLng(Int(Number / 2))
GetRemainder = CLng(Int(Number Mod 2))
End Function
Who's the man???
:)
Hope that helps!
THIS A DYNAMIC WAY. YOU CAN USE ANY TWO NUMBERS!!!
'Need:
'Text1 for numerator
'Text2 for denominator
'Command1 for code below
Dim strRemaindor As String
Dim conRemaindor As String
Dim intNumerator As Integer
Dim intDenominator As Integer
Dim intRemaindor As Integer
Dim intResult As Integer
strRemaindor = ""
intNumerator = Text1
intDenominator = Text2
10
intResult = intNumerator \ intDenominator
intRemaindor = intNumerator Mod intDenominator
intNumerator = intResult
Select Case intRemaindor
Case 0
conRemaindor = "0"
Case 1
conRemaindor = "1"
Case 2
conRemaindor = "2"
Case 3
conRemaindor = "3"
Case 4
conRemaindor = "4"
Case 5
conRemaindor = "5"
Case 6
conRemaindor = "6"
Case 7
conRemaindor = "7"
Case 8
conRemaindor = "8"
Case 9
conRemaindor = "9"
End Select
strRemaindor = strRemaindor & conRemaindor
If intResult <> "0" Then GoTo 10
response = MsgBox("Rev Rem is: " & strRemaindor, vbOkOnly)