Mahmoudelnemr
New Member
- Joined
- May 14, 2019
- Messages
- 5
Hello everyone,
I have userform named "operation" with several textboxes and command button named "cmdUpdate" this button to copy the boxes values after editing it to sheet named "DT" in an existing row it doesnt add new row
the code for this button as follow
When i click the button error message says "run-time error 1004 application-defined or object-defined error" appears
any help with that
I have userform named "operation" with several textboxes and command button named "cmdUpdate" this button to copy the boxes values after editing it to sheet named "DT" in an existing row it doesnt add new row
the code for this button as follow
Code:
Private Sub cmdUpdate_Click()
'update input values to sheet.
Sheets("DT").Unprotect Password:="bsm"
Dim IRow As Long
Dim TBRow As Long
Dim ws As Worksheet
Set ws = Worksheets("DT")
IRow = ws.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
With ws
.Cells(TBRow, 1).Value = Me.DE1.Value
.Cells(TBRow, 2).Value = Me.DE3.Value
.Cells(TBRow, 3).Value = Me.TextBox9.Value
.Cells(TBRow, 4).Value = Me.DE2.Value
.Cells(TBRow, 8).Value = Me.ComboBox1.Value
.Cells(TBRow, 9).Value = Me.TextBox8.Value
.Cells(TBRow, 7).Value = Me.DE8.Value
.Cells(TBRow, 5).Value = Me.DE6.Value
.Cells(TBRow, 6).Value = Me.DE7.Value
End With
Reset
Sheets("DT").Protect Password:="bsm"
End Sub
When i click the button error message says "run-time error 1004 application-defined or object-defined error" appears
any help with that