0
votes

I'm writing a spreadsheet where double-clicking certain cells opens a userform. When certain users click the "X" to close the userform, the whole workbook closes (which is not the intended behavior). This happens if the cell has contents; if the cell is blank, the workbook does not close when the userform closes.

Here is the general code that calls the Userforms:

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)

Dim requestID As Long
Dim rowCount As Long

rowCount = UsedRange.Rows.Count

If (Target.Row > 2) And (Target.Row <= rowCount) Then
    requestID = Cells(Target.Row, 1)
    Select Case Target.Column
        Case 2 To 4
            requestUpdateForm.populate requestID
            requestUpdateForm.Show

        Case 5
            initialSearchForm.populate requestID
            initialSearchForm.Show

        'etc, more forms using Case statements

    End Select
End If

I've seen this behavior before, except it was the opposite: clicking "X" to close a form opened from a blank cell closed the workbook, and this problem went away when I created a new workbook and copied all the code into it.

What puzzles me is that this error is occurring on one user's system and not on another's, even though both have identical installations of Excel.

2
Is there a QueryClose event in the form? If so, what's the code in it?Doug Glancy

2 Answers

1
votes

Maybe there is a problem with the installation of in your system.

Try reinstalling or repairing the installation.

0
votes

I solved it...by restarting--just shutting down the computer and turning it on again.

That's all. I don't know why it worked but it worked.