Thread: Case Studies
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Jim Berglund[_2_] Jim Berglund[_2_] is offline
external usenet poster
 
Posts: 86
Default Case Studies

I have a set of input boxes that all allow a number to be added. The entries
can be:
a. Correct (proceed to the next step)
b. Wrong (doesn't meet a criteria - re-input until correct or blank
c. Blank
The first number can't be blank; subsequent entries can be. If
blank, proceed to the next step*

There are a several ways to do this, including in my order of preference:.
1. Have a multiple-entry input box that would allow input of several
numbers, leaving the others blank.
2. Make it a separate subroutine.
3. Use Cases (I haven't tried this, yet)
4. imbed it in the regular code - what I'm doing, but I'm having difficulty
getting 'out'* on blank entries

Questions:
1. is a multi-entry input box a widget that is available? If so, how can I
get it?
2. What do you experts think is the 'best' approach?
3. How do I get out of a code section without getting into a series of GoTo
statements, that seem to create other problems?

Here's what I'm working with right now...

Do
areaCode2 = InputBox("Enter a Second Area Code, (if required)", "Area
Code 2", "", 80)
If areaCode2 = "" Then GoTo XXX

Set wb = ThisWorkbook
On Error Resume Next
Set wb2 = Workbooks.Open(Filename:=Environ("Userprofile") &
"\Desktop\" & areaCode2 & ".csv", ReadOnly:=True)
If wb2 Is Nothing Then
msg = MsgBox("The Area Code " & areaCode2 & " file does not
exist!" & vbLf & vbLf & "Please try again.", vbExclamation, "Input error")

Else
wb2OK = True
End If
On Error GoTo 0 ' (is '0' the beginning of all the code, or
the 'Do'?)
Loop Until wb2OK = True
XXX:

Suggestions?

Jim Berglund