THNDRacket
New Member
- Joined
- May 26, 2010
- Messages
- 4
I have a mysterious problem in which a MsgBox infinitely displays after clicking its buttons. What is really strange is that the next portion of code executes, but doesn't exit the If statement.
Cell E5 changes accordingly, but the initially hidden rows stay hidden regardless, and the YesNo MsgBox reappears in an infinite loop. What am I missing?
Code:
Sub XcaliburCSV()
Dim XQNFile, ProcMet, InstMet As String
ThisWorkbook.Sheets("Sheet1").Activate
NewCalib = MsgBox("Is this a new calibration?", vbYesNo, "XCalibur Sequence Creation")
If NewCalib = vbYes Then 'NewCalib = 6 for vbYes, 7 for vbNo
Cells(1, 5) = "Yes"
Bracket = "Bracket Type=4"
Sheets("Sheet1").Rows("4:7").Hidden = False
MsgBox ("NewCalib = " & NewCalib & vbCr & "Bracket = " & Bracket)
Else
Cells(1, 5) = "No"
Bracket = "Bracket Type=2"
Sheets("Sheet1").Rows("4:7").Hidden = True
End If
XQNFile = SelectFile("Select Calibration File...", "*.XQN")
InstrMet = SelectFile("Select Instrument Method...", "*.meth")
ProcMet = SelectFile("Select Processing Method...", "*.pmd")
With ActiveWorkbook.Sheets("Sheet1")
.Range("B20") = XQNFile
.Range("B21") = InstrMet
.Range("B22") = ProcMet
End With
ThisWorkbook.Sheets("Xcalibur Sequence").Cells(1, 1).Value = Bracket
End Sub
Cell E5 changes accordingly, but the initially hidden rows stay hidden regardless, and the YesNo MsgBox reappears in an infinite loop. What am I missing?