bonjour tout le monde
je rencontre un petit probleme dans mon code vba et je voudrais savois si jai bien ecrit le code ou pas
ma feuil s'appel employ, colone A (ID), colone B (lastname), colone C (firtname), colone D ( Genre (male,femelle))
Private Sub Cbtedit_Click()
Dim rng1 As Range
Dim str_search As String
str_search = Me.Cbocherche.Value
ActiveWorkbook.Sheets("employ").Activate
Set rng1 = Sheets("employ").Range("B:B").Find(str_search, , xlValues, xlWhole)
If Not rng1 Is Nothing Then
rng1.Select
Dim row_number As Long
row_number = ActiveCell.Row
With ActiveWorkbook.Sheets("employ")
.Range("b" & row_number).Value = Me.Txtlastname.Value
.Range("c" & row_number).Value = Me.Txtfirstname.Value
.Range("d" & row_number).Value = Me.Cbogenre.Value
.Range("e" & row_number).Value = Me.TxtBirth.Value
End With
Else
MsgBox str_search & "Not Found"
End If
End Sub
quand je fait le test il y a que le colone lasname qui change et le reste non
cordialement
je rencontre un petit probleme dans mon code vba et je voudrais savois si jai bien ecrit le code ou pas
ma feuil s'appel employ, colone A (ID), colone B (lastname), colone C (firtname), colone D ( Genre (male,femelle))
Private Sub Cbtedit_Click()
Dim rng1 As Range
Dim str_search As String
str_search = Me.Cbocherche.Value
ActiveWorkbook.Sheets("employ").Activate
Set rng1 = Sheets("employ").Range("B:B").Find(str_search, , xlValues, xlWhole)
If Not rng1 Is Nothing Then
rng1.Select
Dim row_number As Long
row_number = ActiveCell.Row
With ActiveWorkbook.Sheets("employ")
.Range("b" & row_number).Value = Me.Txtlastname.Value
.Range("c" & row_number).Value = Me.Txtfirstname.Value
.Range("d" & row_number).Value = Me.Cbogenre.Value
.Range("e" & row_number).Value = Me.TxtBirth.Value
End With
Else
MsgBox str_search & "Not Found"
End If
End Sub
quand je fait le test il y a que le colone lasname qui change et le reste non
cordialement