Originally Posted by
BexleyManor
Daniel,
Quote " PS: Have you thought about giving the user the possibility to stop the outer loop without having to fill out all lines? Or must the user fill out all of them?"
I hadn't actually thought of this (doh!!) but yes, that would be a great feature.
How would I got about this??
Try this for starters...you can refine and change it to whatever you want afterwards
(Have just changed steiners' code slightly to read "For iii = 16 To 100" and added a message box)
Sub Iput2()
Dim Prompt As Variant, Ipt(8) As Variant, i As Integer, ii As Integer, iii As Integer
Dim Msg, Style, Title, Help, Ctxt, Response, MyString
i = 0
ii = 0
iii = 16
Range("A16:I100") = ""
Prompt = Array("Line", "Supplier Code", "Full Description", "Acct Code", "Quantity", "UOM", "Price per UOM", "Delivery Date")
For iii = 16 To 100
For i = 0 To 7
Do
Ipt(i) = InputBox("Please enter " & Prompt(i) & Chr(10) & Chr(10) & "Press Spacebar & Ok to leave box blank.")
Loop While Ipt(i) = ""
Next I
Range("A" & iii).Value = Ipt(0)
Range("B" & iii).Value = Ipt(1)
Range("C" & iii).Value = Ipt(2)
Range("E" & iii).Value = Ipt(3)
Range("F" & iii).Value = Ipt(4)
Range("G" & iii).Value = Ipt(5)
Range("H" & iii).Value = Ipt(6)
Range("I" & iii).Value = Ipt(7)
Msg = "Any More Entries ?" ' Define message.
Style = vbYesNo + vbCritical + vbDefaultButton2 ' Define buttons.
Title = "MsgBox Demonstration" ' Define title.
Help = "DEMO.HLP" ' Define Help file.
Ctxt = 1000
Response = MsgBox(Msg, Style, Title, Help, Ctxt)
If Response = vbYes Then ' User chose Yes.
MyString = "Yes" ' Perform some action.
Else: MyString = "No": GoTo line100 ' Perform some action.
End If
Erase Ipt()
Next iii
line100: 'Next step is End Sub :bink: 'leave the smilies outta the code tho :cool:
End Sub