Patriot2879
Well-known Member
- Joined
- Feb 1, 2018
- Messages
- 1,259
- Office Version
- 2010
- Platform
- Windows
Hi I have the code below for the ID which is textbox18, what I want is if a person has an update they go into the userform and enter the number id then what they want updated in other textboxes and then click the update button. what this should do is find the ID in sheet1 and update the same row with the ID. For example Textbox18 which is in the code for the update button to update row 'O'. The ID in sheet1 is located in Row G. can you help please.
And the update button code is:-
Code:
Private Sub TextBox18_Change()
Dim TextBox18 As Integer
If Me.TextBox18.value = “” Then
Exit Sub
End If
Box18 = TextBox18.value
On Error Resume Next
Me.TextBox14.Value = Application.WorksheetFunction.VLookup(TextBox18, Sheets(“Sheet1”).Range(“05:R1087”), 7, 15)
End Sub
And the update button code is:-
Code:
Private Sub CommandButton1_Click()
End If
TextBox18 = Me.TextBox18.value
Sheets("Sheet1").Select
Dim rowselect As Double
rowselect = Me.TextBox18.value
rowselect = rowselect + 1
Rows(rowselect).Select
Cells(rowselect, 18) = Me.TextBox14.value
Dim emptyRow As Long
With ThisWorkbook.Sheets("Sheet1")
emptyRow = Cells(Rows.Count, "A").End(xlUp).Row + 1
.Cells(emptyRow, 15).value = TextBox14.value
.Cells(emptyRow, 16).value = TextBox15.value
.Cells(emptyRow, 17).value = TextBox16.value
.Cells(emptyRow, 18).value = TextBox17.value
End With
Unload Me
End Sub