Home |
Search |
Today's Posts |
#1
![]() |
|||
|
|||
![]() i use a user form to input data into 3 columns. as i inventory i find duplicate items. when i input the data into the form it just puts the new info at the bottom of the table. is there a way to make the user form realize it is about to input duplcate data and just change the 2nd column (quantity) the other 2 columns are never changing (id) (name). here is my source code Private Sub cmdADD_Click() Dim iRow As Long Dim ws As Worksheet Set ws = ActiveSheet '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.txtNumber.Value) = "" Then Me.txtNumber.SetFocus MsgBox "Please enter the card number" Exit Sub End If 'copy the data to the database ws.Cells(iRow, 1).Value = Me.txtNumber.Value ws.Cells(iRow, 2).Value = Me.txtQuantity.Value ws.Cells(iRow, 3).Value = Me.txtName.Value 'clear the data Me.txtNumber.Value = "" Me.txtQuantity.Value = "1" Me.txtName.Value = "" Me.txtNumber.SetFocus End Sub -- static69 ------------------------------------------------------------------------ static69's Profile: http://www.excelforum.com/member.php...o&userid=11075 View this thread: http://www.excelforum.com/showthread...hreadid=342713 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Data Entry Alert in User Form | Excel Discussion (Misc queries) | |||
Trying to delete form border, and it deletes all borders | Excel Discussion (Misc queries) | |||
VBA Form Global Name Changes | Excel Discussion (Misc queries) | |||
A "previous" button on a user form | Excel Discussion (Misc queries) | |||
find and match the max | Excel Worksheet Functions |