Results 1 to 3 of 3

User form Data Entry Help VBA

Threaded View

yates1_99 User form Data Entry Help VBA 08-24-2015, 12:50 AM
skywriter Re: User form Data Entry Help... 08-24-2015, 12:59 AM
yates1_99 Re: User form Data Entry Help... 08-24-2015, 01:14 AM
  1. #1
    Registered User
    Join Date
    08-24-2015
    Location
    Denver
    MS-Off Ver
    2013
    Posts
    17

    User form Data Entry Help VBA

    My question I guess is how do I take this information verify the data, find duplicate entries, replace or overwrite, count rows, insert information without overwriting information

    i.e.

    Coloumn 1
    Asset Name Asset Class Description Location Customer State Asset No. Comments Employee: Serial No.
    10 HP HS Pump Equipment ********* ******** Wyoming 25373 Me



    Userform 1
    Option Explicit
    
    Dim Employee As String
    Dim EquipmentDescription As String
    Dim AssetNumber As String
    Dim TransferFrom As String
    Dim TransferTo As String
    Dim SerialNumber As String
    Dim id As Integer, i As Integer, j As Integer, flag As Boolean
    
    Private Sub CommandButton2_Click()
    Dim z As Control
     For Each z In UserForm2.Controls
     If TypeName(z) = "TextBox" Then
     z.Value = ""
     End If
     Next z
     
    End Sub
    
    Private Sub AssetNumberTextbox_Change()
    If AssetNumberTextbox.Text = "" Then
    MsgBox ("Please Enter Asset Number")
    AssetNumberTextbox.SetFocus
    SubmitButton.Enabled = False
    Else
    AssetNumber = AssetNumberTextbox.Text
    End If
    End Sub
    
    Private Sub CommandButton1_Click()
    Unload UserForm2
    End Sub
    
    Private Sub CommandButton3_Click()
    UserForm2.Show
    Dim AssetTransfer As Long
    AssetTransfer = Sheet25.Cells.Range("A33:B38").Value
    Sheet25.Activate
    Sheet25.Cells.Range("AssetTransfer").Copy
    AssetTransfer.Cells(2, 0).End(xlToLeft).Offset(0, 1).PasteSpecial _
            Paste:=xlPasteValues, Operation:=xlNone, _
            SkipBlanks:=False, Transpose:=False
    End Sub
    
    Private Sub DescriptionTextBox_Change()
    If DescriptionTextBox.Text = "" Then
    MsgBox ("Please Enter Equipment Description")
    DescriptionTextBox.SetFocus
    SubmitButton.Enabled = False
    Else
    EquipmentDescription = DescriptionTextBox.Text
    End If
    
    End Sub
    
    Private Sub EmployeeTextBox_Change()
    If EmployeeTextBox.Text = "" Then
    MsgBox ("Please Enter Employee's Name")
    EmployeeTextBox.SetFocus
    SubmitButton.Enabled = False
    Else
    Employee = EmployeeTextBox.Text
    End If
    End Sub
    
    Private Sub SNTextBox_Change()
    SerialNumber = SNTextBox.Text
    End Sub
    
    Private Sub SubmitButton_Click()
    Dim NextRow As Long
    Sheets("EOW").Activate
    Sheet25.Cells.Range("C33:I33") = Employee
    Sheet25.Cells.Range("C34:I34") = EquipmentDescription
    Sheet25.Cells.Range("C35:I35") = AssetNumber
    Sheet25.Cells.Range("C36:I36") = SerialNumber
    Sheet25.Cells.Range("C37:I37") = TransferFrom
    Sheet25.Cells.Range("C38:I38") = TransferTo
    End Sub
    
    Private Sub TransferFromTextBox_Change()
    If TransferFromTextBox.Text = "" Then
    MsgBox ("Please Enter Previous Location or Starting Location of Asset")
    TransferFromTextBox.SetFocus
    SubmitButton.Enabled = False
    Else
    TransferFrom = TransferFromTextBox.Text
    End If
    End Sub
    
    Private Sub TransferToTextbox_Change()
    If TransferToTextBox = "" Then
    MsgBox ("Please Enter Destination's Location for the Asset Transfered")
    TransferToTextBox.SetFocus
    SubmitButton.Enabled = False
    Else
    TransferTo = TransferToTextBox.Text
    SubmitButton.Enabled = True
    End If
    End Sub
    
    Private Sub UserForm_Initialize()
    EmployeeTextBox.SetFocus
    End Sub
    
    Private Sub Submit()
    If Employee.Value And EquipmentDescription.Value And AssetNumber.Value And TransferFrom.Value And TransferTo.Value > 0 Then
    SubmitButton.Enabled = True
    Else
    SubmitButton.Enabled = False
    MsgBox ("Please Enter Missing Values")
    
    End Sub
    Userform 2
    Option Explicit
    
    Dim Employee As String
    Dim EquipmentDescription As String
    Dim AssetNumber As String
    Dim TransferFrom As String
    Dim TransferTo As String
    Dim SerialNumber As String
    Dim id As Integer, i As Integer, j As Integer, flag As Boolean
    
    Private Sub CommandButton2_Click()
    Dim z As Control
     For Each z In UserForm2.Controls
     If TypeName(z) = "TextBox" Then
     z.Value = ""
     End If
     Next z
     
    End Sub
    
    Private Sub AssetNumberTextbox_Change()
    If AssetNumberTextbox.Text = "" Then
    MsgBox ("Please Enter Asset Number")
    AssetNumberTextbox.SetFocus
    SubmitButton.Enabled = False
    Else
    AssetNumber = Cstr(AssetNumberTextbox.Text)
    End If
    End Sub
    
    Private Sub CommandButton1_Click()
    Unload UserForm2
    End Sub
    
    Private Sub CommandButton3_Click() 'this doesn't work yet
    UserForm2.Show
    Dim AssetTransfer As Long
    AssetTransfer = Sheet25.Cells.Range("A33:B38").Value
    Sheet25.Activate
    Sheet25.Cells.Range("AssetTransfer").Copy
    AssetTransfer.Cells(2, 0).End(xlToLeft).Offset(0, 1).PasteSpecial _
            Paste:=xlPasteValues, Operation:=xlNone, _
            SkipBlanks:=False, Transpose:=False
    End Sub
    
    Private Sub DescriptionTextBox_Change()
    If DescriptionTextBox.Text = "" Then
    MsgBox ("Please Enter Equipment Description")
    DescriptionTextBox.SetFocus
    SubmitButton.Enabled = False
    Else
    EquipmentDescription = DescriptionTextBox.Text
    End If
    
    End Sub
    
    Private Sub EmployeeTextBox_Change()
    If EmployeeTextBox.Text = "" Then
    MsgBox ("Please Enter Employee's Name")
    EmployeeTextBox.SetFocus
    SubmitButton.Enabled = False
    Else
    Employee = EmployeeTextBox.Text
    End If
    End Sub
    
    Private Sub SNTextBox_Change()
    SerialNumber = SNTextBox.Text
    End Sub
    
    Private Sub SubmitButton_Click()
    Dim NextRow As Long
    Sheets("EOW").Activate
    Sheet25.Cells.Range("C33:I33") = Employee
    Sheet25.Cells.Range("C34:I34") = EquipmentDescription
    Sheet25.Cells.Range("C35:I35") = AssetNumber
    Sheet25.Cells.Range("C36:I36") = SerialNumber
    Sheet25.Cells.Range("C37:I37") = TransferFrom
    Sheet25.Cells.Range("C38:I38") = TransferTo
    End Sub
    
    Private Sub TransferFromTextBox_Change()
    If TransferFromTextBox.Text = "" Then
    MsgBox ("Please Enter Previous Location or Starting Location of Asset")
    TransferFromTextBox.SetFocus
    SubmitButton.Enabled = False
    Else
    TransferFrom = TransferFromTextBox.Text
    End If
    End Sub
    
    Private Sub TransferToTextbox_Change()
    If TransferToTextBox = "" Then
    MsgBox ("Please Enter Destination's Location for the Asset Transfered")
    TransferToTextBox.SetFocus
    SubmitButton.Enabled = False
    Else
    TransferTo = TransferToTextBox.Text
    SubmitButton.Enabled = True
    End If
    End Sub
    
    Private Sub UserForm_Initialize()
    EmployeeTextBox.SetFocus
    End Sub
    
    Private Sub Submit()
    If Employee.Value And EquipmentDescription.Value And AssetNumber.Value And TransferFrom.Value And TransferTo.Value > 0 Then
    SubmitButton.Enabled = True
    Else
    SubmitButton.Enabled = False
    MsgBox ("Please Enter Missing Values")
    
    End Sub
    Any help or suggestions is greatly appreciated
    Last edited by yates1_99; 08-24-2015 at 02:41 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. User Form Data Entry
    By caltman242 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-14-2015, 04:36 AM
  2. I need to make data entry user form
    By gunatilake.dayan in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-07-2014, 10:35 AM
  3. [SOLVED] EXCEL USER FORM- Data entry in all capitals
    By PANTECH in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-17-2013, 03:10 PM
  4. Select user form with data entry
    By itsunclebill in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-01-2010, 12:07 AM
  5. User Form for Data Entry In Excel
    By tariqnaz2005 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-10-2009, 09:40 AM
  6. Data Entry Alert in User Form
    By Kev in forum Excel General
    Replies: 7
    Last Post: 01-08-2005, 11:06 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