colombo2003
colombo2003

Reputation: 111

Reopen a UserForm

I have been stuggling for same time now but I don't now how to do that...

When I select a cell in column Q, I get a userform (which is ok).

In that userform I have the content of the selected cell (e.g. Q6) (which is ok)

In userform I have two buttons: - quit: which closes the userform without saving the text in the cell; - save: which save the text in the cell from userform.

Both at saving and quitting the selections (focus) remain on that cell (Q6).

I want when I click again on the Q6 (witch is already selected), the userform reopen again.

The only solution I found so far, is to change the selection (for exemple on P6).

Cam anyone, please, help me? Thx.

Upvotes: 0

Views: 1610

Answers (1)

John Coleman
John Coleman

Reputation: 51988

In addition to how you are currently showing the form, you could add a double-click event handler. In the sheet's code module do something like this:

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
    If Target.Column = Range("Q1").Column Then
        UserForm1.Show
        Cancel = True
    End If
End Sub

Instruct the users that if they want to reshow the form, they should double click on the currently selected cell.

Upvotes: 2

Related Questions