1. Welcome to Chandoo.org Forums. Short message for you

    Hi Guest,

    Thanks for joining Chandoo.org forums. We are here to make you awesome in Excel. Before you post your first question, please read this short introduction guide. When posting or responding to questions please remember our values at Chandoo.org are: Humility, Passion, Fun, Awesomeness, Simplicity, Sharing Remember that we have people here for whom English is not there first language and we need to allow for this in our dealings.

    Yours,
    Chandoo
  2. Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  3. When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

User Form

Discussion in 'VBA Macros' started by sumit Madaan, Mar 15, 2019 at 11:32 AM.

  1. sumit Madaan

    sumit Madaan New Member

    Messages:
    7
    I Need VBA code userform not get closed(cross sign X) till the time value in textbox is empty.

    I dont want this code in any command button. i need when user will click on excel, userform display to him on screen and he will not be able to close the userform till the time value in textbox is not entered.

    Thanks in advance.
  2. ANKUSHRS1

    ANKUSHRS1 Member

    Messages:
    91
    what do you exactly want to do in excel?
    please give details or sample.
  3. Belleke

    Belleke Active Member

    Messages:
    560
    Hi,
    Like this?
    Code (vb):
    Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
    If TextBox1 = "" Then
    Cancel = True
    MsgBox "Time value is a mandatory field", vbCritical, "Error"
    Else
    End If
    End Sub

Share This Page