himaruasuka
New Member
- Joined
- May 26, 2022
- Messages
- 10
- Office Version
- 2013
- Platform
- Windows
- Mobile
Good Day!
Sir/Madam, I need help. I don't know how to fix this, I'm new to this. Codes is fine but it didn't find the product item. But if I change from".listcolumn(1)" to ".listcolumn(2)" it can edit the data but It is starts to edit the data at the column3(G), its out of the "listobject(table)."
Anyone who can help me? Thanks in Advance!
Sir/Madam, I need help. I don't know how to fix this, I'm new to this. Codes is fine but it didn't find the product item. But if I change from".listcolumn(1)" to ".listcolumn(2)" it can edit the data but It is starts to edit the data at the column3(G), its out of the "listobject(table)."
Anyone who can help me? Thanks in Advance!
VBA Code:
Private Sub Edit_Search_Click()
Dim rFound As Range
Dim sID As String
sID = Me.Search_box.Value
With Worksheets("Inventory").ListObjects("Table1").ListColumns(1).DataBodyRange
Set rFound = .Find(what:=sID, LookIn:=xlValues, lookat:=xlWhole, MatchCase:=False)
End With
If Not rFound Is Nothing Then
Worksheets("Inventory").Unprotect "Roshier"
rFound.Offset(, "E").Value = Me.display_cat.Text
rFound.Offset(, "F").Value = Me.display_item.Text
rFound.Offset(, "G").Value = Me.display_cost.Text
rFound.Offset(, "H").Value = Me.display_bundle.Text
rFound.Offset(, "J").Value = Me.display_price.Text
rFound.Offset(, "K").Value = Me.display_remarks.Text
Else
MsgBox "Product Item '" & sID & "' not found.", vbExclamation
Worksheets("Inventory").Protect "Roshier"
End If
End Sub