repeating macro

JasonLevan

Registered User.
Local time
Today, 18:38
Joined
Jan 25, 2011
Messages
21
I have the following macro
Sub TestMacro()
Range("A2").Select
ActiveCell.FormulaR1C1 = InputBox("Item Number")
Range("B2").Select
ActiveCell.FormulaR1C1 = InputBox("Qty #")
Range("C2").Select

End Sub
it works fine but i want it to repeat itself over and over until I end like the word end or stop or press a number. Any way to do such a thing
 
Untested, but try

Code:
Sub TestMacro()
  Do While 1=1
    If InputBox("Stop yet?") = "stop" Then
      Exit Do
    End If

    Range("A2").Select
    ActiveCell.FormulaR1C1 = InputBox("Item Number")
    Range("B2").Select
    ActiveCell.FormulaR1C1 = InputBox("Qty #")
    Range("C2").Select
  Loop
End Sub

You could also test one of your existing InputBox results if you wanted.
 
good start but I dont want it to ask me if i want to stop every time, can it just notice the "stop command" if i enter it into the item number field
 

Users who are viewing this thread

Back
Top Bottom