Private Sub cmd_ok_Click()
Me.Hide
If Me.tb_id.Value <> Range("A" & Selection.Row).Value Then
Range("A" & Selection.Row).Value = Me.tb_id.Value
Range("C" & Selection.Row & ":C" & Range("C" & Selection.Row).End(xlDown).Row). _
Replace What:=Range("C" & Selection.Row).Value, Replacement:=Me.tb_id.Value
End If
If Me.tb_name.Value <> Range("B" & Selection.Row).Value Then _
Range("B" & Selection.Row).Value = Me.tb_name.Value
End Sub
Private Sub cmd_ok_Click()
Dim l
Sheet1.Activate
l = Selection.Row
Sheet1.Cells(l, 1) = Me.tb_id
Sheet1.Cells(l, 2) = Me.tb_name
Sheet1.[c2:C65536].Replace What:=id_old, Replacement:=Me.tb_id, LookAt:=xlWhole
Unload Me
End Sub
Private Sub Test()
Dim dg
With Me
dg = WorksheetFunction.CountIf(Sheet1.[a2:a65536], .tb_id)
.cmd_ok.Enabled = IIf(dg = 0, (Trim(.tb_id.Value) <> id_old Or Trim(.tb_name.Value) <> name_old), False)
End With
Exit Sub
End Sub