Try below code ... You can add more fields
Private Sub CommandButton2_Click()
'update record
Dim Rg As Range
If VinNumber.Value = "" Then
MsgBox "Please enter the VIN #", vbExclamation
VinNumber.SetFocus
Exit Sub
End If
With Sheets("Stock Table").ListObjects(1).DataBodyRange
Set Rg = .Columns(1).Find(VinNumber.Value, lookat:=xlWhole)
If Rg Is Nothing Then
MsgBox VinNumber.Value & " is not available !", vbExclamation
Exit Sub
Else
Rg.Offset(, 2).Value = VehicleMake.Value
Rg.Offset(, 4).Value = StockLocation.Value
Rg.Offset(, 5).Value = GefcoReference.Value
Rg.Offset(, 12).Value = PodReference.Value
End If
End With
End Sub
Private Sub CommandButton3_Click()
'search button
Dim Rg As Range
If VinNumber.Value = "" Then
MsgBox "Please enter the VIN #", vbExclamation
VinNumber.SetFocus
Exit Sub
End If
With Sheets("Stock Table").ListObjects(1).DataBodyRange
Set Rg = .Columns(1).Find(VinNumber.Value, lookat:=xlWhole)
If Rg Is Nothing Then
MsgBox VinNumber.Value & " is not available !", vbExclamation
Exit Sub
Else
VehicleMake.Value = Rg.Offset(, 2).Value
StockLocation.Value = Rg.Offset(, 4).Value
GefcoReference.Value = Rg.Offset(, 5).Value
PodReference.Value = Rg.Offset(, 12).Value
End If
End With
End Sub
Bookmarks