Results 1 to 6 of 6

User Form Required Fields

Threaded View

  1. #1
    Registered User
    Join Date
    05-22-2014
    Posts
    63

    User Form Required Fields

    I have a user form and I need the fields to be required to be filled before it can be closed. Right now I have. . .
    Private Sub BTNSave_Click()
    
    TargetRow = Range("A" & Rows.Count).End(xlUp).Row + 1
    X = TargetRow - 3
    DT = Format(Now, "mm/dd/yyyy hh:mm:ss AM/PM")
    
    
    
    Cells(TargetRow, 4).Value = TXTWhatsYourName.Text
    If TXTWhatsYourName = "" Then MsgBox ("You Must Enter A Name!")
    
    Cells(TargetRow, 7).Value = TXTDescription.Text
    If TXTDescription = "" Then MsgBox ("You Must Enter A Description!")
    
    Cells(TargetRow, 5).Value = TXTWOname.Text
    If TXTWOname = "" Then MsgBox ("You Must Enter A Work Order Number!")
    
    Cells(TargetRow, 6).Value = TXTPartsNumber.Text
    If TXTPartsNumber = "" Then MsgBox ("You Must Enter A PartNumber!")
    
    Cells(TargetRow, 8).Value = TXTPartsQTY.Text
    If TXTPartsQTY = "" Then MsgBox ("You Must Enter A Quantity!")
    
    Cells(TargetRow, 9).Value = TXTNeededbydateandtime.Text
    If TXTNeededbydateandtime = "" Then MsgBox ("You Must Enter A Date and Time!")
    
    Cells(TargetRow, 10).Value = DDUnitOnFloor.Value
    If DDUnitOnFloor = "" Then MsgBox ("You must choose from Unit on the Floor!")
    
    Cells(TargetRow, 11).Value = DDReason.Text
    If DDReason = "" Then MsgBox ("You must choose a Reason!")
    
    Cells(TargetRow, 12).Value = DDManufacturingArea.Text
    If DDManufacturingArea = "" Then MsgBox ("You must choose a Manufacturing Area!")
    
    Cells(TargetRow, 13).Value = DDDPUEntered.Text
    If DDDPUEntered = "" Then MsgBox ("Was DPU Entered?")
    
    Cells(TargetRow, 15).Value = DDDiditgotodesign.Text
    If DDDiditgotodesign = "" Then MsgBox ("Did it go to design?")
    
    Cells(TargetRow, 16).Value = TXTWhoDidDPU.Text
    If TXTWhoDidDPU = "" Then MsgBox ("Who Did DPU?")
    
    
    
    Cells(TargetRow, 1) = X
    Cells(TargetRow, 3).Value = DT
    Cells(TargetRow, 2).Interior.Color = vbGreen
    
    Me.Hide
    Unload Me
    ActiveWorkbook.Save
    
    End Sub
    I would like everything before Cells . . = X to be required before it can be closed. How is this done? Thank you!
    Last edited by hhpack3; 07-02-2014 at 09:38 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Make multiple fields required in form before save
    By tclemente in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 03-03-2014, 12:34 PM
  2. Filling form fields via worksheet dropdowns, user update via form, change form color
    By Demosthenes&Locke in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-11-2010, 08:58 AM
  3. Help required in user form
    By umayank in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-28-2009, 11:37 AM
  4. Best way to fill user form fields
    By evanzo in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-23-2008, 09:41 PM
  5. Example User Form Required
    By robertguy in forum Excel General
    Replies: 0
    Last Post: 10-04-2005, 09:25 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