Public Fila
Dim h

Private Sub lb_modificar_Click()
'Por.Dante Amor
    If Fila > 0 Then
        h.Cells(Fila, "A") = txt_codigo.Value
        h.Cells(Fila, "B") = txt_nombre.Value
        h.Cells(Fila, "C") = txt_ubicacion.Value
        h.Cells(Fila, "D") = txt_compra.Value
        h.Cells(Fila, "E") = txt_beneficio.Value
        h.Cells(Fila, "F") = txt_venta.Value
        h.Cells(Fila, "G") = txt_stock.Value
        
    End If
    MsgBox "ARTÍCULO modificado", vbInformation, "CONTROL DE ALMACÉN"
    Unload Me
    With frm_articulos
        .txt_buscar = ""
        .Image1.Picture = Nothing
        .txt_buscar.SetFocus
    End With
End Sub

Private Sub UserForm_Activate()
'Por.Dante Amor
    Set h = Sheets("ARTICULOS")
    If Fila > 0 Then
        txt_codigo.Value = h.Cells(Fila, "A")
        txt_nombre.Value = h.Cells(Fila, "B")
        txt_ubicacion.Value = h.Cells(Fila, "C")
        txt_compra.Value = h.Cells(Fila, "D")
        txt_compra = Format(txt_compra, "currency")
        txt_beneficio.Value = h.Cells(Fila, "E")
        txt_venta.Value = h.Cells(Fila, "F")
        txt_venta = Format(txt_venta, "currency")
        txt_stock.Value = h.Cells(Fila, "G")
        
            ruta = ThisWorkbook.Path & "\imagenes\"
            arch = txt_nombre.Text & ".jpg"
            If Dir(ruta & arch) <> "" Then
                Image1.Picture = LoadPicture(ruta & arch)
                Image1.PictureSizeMode = fmPictureSizeModeStretch
            Else
                If Dir(ruta & "10102000.jpg") <> "" Then
                    Image1.Picture = LoadPicture(ruta & "10102000.jpg")
                End If
            End If
    End If
    
    txt_codigo.SetFocus
    
End Sub