Hello all, my first time here and beginning VBA user. I designed a calculator which compiles and interpretes the results of 9 different sets of output from image analysis software. I always name the 8 output files identical: 1 to 9 (excel workbooks). To start the calculator I use a messagebox which allows me to navigate to the particular location from which I would like to open the 9 workbooks (see below code). What currently happens is that if I don't select any files I exit the sub. What I would like is for the sub to end if I don't select 9 files (<9). As I mentioned I am a beginner but can't find the solution anywhere. Much thanks.
Dim fd As FileDialog
Dim file_was_chosen As Boolean
Set fd = Application.FileDialog(msoFileDialogOpen)
With fd
.Filters.Clear
.Filters.Add "Excel File", "*.xl*"
End With
file_was_chosen = fd.Show
If Not file_was_chosen Then
MsgBox "You didn't select a file"
Exit Sub
End If
fd.Execute
Dim fd As FileDialog
Dim file_was_chosen As Boolean
Set fd = Application.FileDialog(msoFileDialogOpen)
With fd
.Filters.Clear
.Filters.Add "Excel File", "*.xl*"
End With
file_was_chosen = fd.Show
If Not file_was_chosen Then
MsgBox "You didn't select a file"
Exit Sub
End If
fd.Execute