Im trying to create a gui so my employees can update our inventory without having to touch the data. The program prompts them for all sorts of infomation. At the end i want it to take txtLocation, find it in the workbook and replace it with all data that has been entered(multiple cells). As of right now it just places the data in the next available of a very specific sheet.
Private Sub cmdAdd_Click()
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("NewData")
'find first empty row in database
iRow = ws.Cells(Rows.Count, 1) _
.End(xlUp).Offset(1, 0).Row
'check for a part number
If Trim(Me.txtLocation.Value) = "" Then
Me.txtLocation.SetFocus
MsgBox "Please enter a Location"
'ElseIf Trim(Me.txtSuperiorOrderNumber.Value) = "" Then
' Me.txtLocation.SetFocus
'MsgBox "Please enter a Superior Order Number"
'ElseIf Trim(Me.txtSerialNumber.Value) = "" Then
' Me.txtLocation.SetFocus
'MsgBox "Please enter a Serial Number"
'ElseIf Trim(Me.txtEngineType.Value) = "" Then
'Me.txtLocation.SetFocus
'MsgBox "Please enter Engine Type"
'ElseIf Trim(Me.txtCustom.Value) = "" Then
'Me.txtLocation.SetFocus
'MsgBox "Please enter Customer"
'ElseIf Trim(Me.txtTraced.Value) = "" Then
'Me.txtLocation.SetFocus
'MsgBox "Please enter whether it has been traced or not"
Exit Sub
End If
'copy the data to the database
ws.Cells(iRow, 1).Value = Me.txtLocation.Value
ws.Cells(iRow, 2).Value = Me.txtSuperiorOrderNumber.Value
ws.Cells(iRow, 3).Value = Me.txtSerialNumber.Value
ws.Cells(iRow, 4).Value = Me.txtEngineType.Value
ws.Cells(iRow, 5).Value = Me.txtCustom.Value
ws.Cells(iRow, 6).Value = Me.txtTraced.Value
End Sub
Bookmarks