It can be done using a couple of arrays & a function but as Jim has already
stated, userform would be easier.
However, if you want to pursue the inputbox idea then try the following as
an approach - it asks six questions which are stored in an array. I have
displayed these values in msgbox but you would use them as required in your
application.
Post all code in standard module (not fully tested)
Dim Title As String
Sub EnterData()
Dim myarray(6) As Variant
Dim Entryarray()
Title = "Enter Company Data"
Entryarray = Array("Company Name", _
"Address", _
"Telephone No", _
"Business Sector", _
"Contact Name", _
"Contact Email")
i = 0
Do
'msgbox msg shown
when
'value set to 1
(required entry)
'inputbox prompt 'set to 0 when
blank entry valid
myarray(i) = get_Input("Enter " & Entryarray(i), Entryarray(i), 1)
If myarray(i) = False Then Exit Sub
i = i + 1
Loop Until i > 5
'sample code to show array data
i = 0
Do
MsgBox myarray(i)
i = i + 1
Loop Until i > 5
End Sub
Function get_Input(msg, entry, eflag)
Rem eflag determines whether the prompt msgbox
Rem is displayed when nothing is input
label:
userin = Application.InputBox(msg, Title)
If userin = False Then
msg1 = MsgBox("You pressed CANCEL - Do you want to Exit?", 292, Title)
If msg1 = 7 Then
GoTo label
Else
Exit Function
End If
ElseIf userin = "" And eflag = 1 Then
Prompt = MsgBox("Nothing Input!" & Chr(10) & entry & " MUST be
Entered", 48, entry)
GoTo label
End If
get_Input = userin
End Function
Hope helpful