Results 1 to 12 of 12

Return to userform after msgbox?

Threaded View

  1. #1
    Registered User
    Join Date
    02-05-2014
    Location
    Denmark
    MS-Off Ver
    Excel 2007
    Posts
    7

    Return to userform after msgbox?

    I want to return to the userform if the msgbox occurres (then a text / listbox is empty) so the textbox can be filled before populating the data to the worksheet.

    Can anyone help me please?

    Private Sub CommandButton1_Click()
    
    If ListBox5.Value = "" Or ListBox1.Value = "" Or CheckBox1.Value = False And CheckBox2.Value = False Or ListBox3.Value = "" Or ListBox6.Value = "" Or ListBox7.Value = "" Or TextBox3.Value = "" Or ListBox2.Value = "" Or TextBox1.Value = "" Or TextBox2.Value = "" Or TextBox4.Value = "" Or DTPicker1.Value = "" Then MsgBox "Please fill in all content"
    
        Worksheets("Data").Range("A3").Value = ListBox5.Value 
        Worksheets("Data").Range("B3").Value = ListBox1.Value 
        Worksheets("Data").Range("C3").Value = TextBox6.Value 
        Worksheets("Data").Range("E3").Value = ListBox3.Value 
        Worksheets("Data").Range("F3").Value = ListBox6.Value 
        Worksheets("Data").Range("G3").Value = ListBox7.Value 
    
            If CheckBox1.Value = True Then
            Worksheets("Data").Range("H3").Value = "YES"
            End If
    
            If CheckBox2.Value = True Then
            Worksheets("Data").Range("H3").Value = "NO"
            End If
    
        Worksheets("Data").Range("I3").Value = TextBox3.Value 
        Worksheets("Data").Range("J3").Value = ListBox2.Value
        Worksheets("Data").Range("L3").Value = TextBox1.Value 
        Worksheets("Data").Range("M3").Value = TextBox2.Value
        Worksheets("Data").Range("N3").Value = TextBox4.Value 
        Worksheets("Data").Range("O3").Value = DTPicker1.Value 
        Worksheets("Data").Range("P3").Value = TextBox7.Value 
    
    
        Unload Me
        Worksheets("Overview").Select
        Range("A2").Select
    End Sub
    Last edited by dbjofo; 02-06-2014 at 11:26 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] How to unolad userform using msgbox
    By GIS2013 in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 08-29-2013, 05:52 PM
  2. [SOLVED] Userform msgbox option to return to parent form
    By Hammer_757 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-27-2012, 02:19 PM
  3. UserForm or MsgBox without code interruption?
    By Riggers in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-20-2011, 07:45 AM
  4. Substituting MsgBox with Userform
    By Volkanismo in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 05-26-2011, 03:12 AM
  5. Adding MsgBox to Userform
    By buckchow in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-31-2007, 12:45 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1