Bug inexplicable
h
Tous le code fonction
et sur un autre useform quand je delete pas de soucis avec la cb
mais dans celui ci ca me met une erreur
Private Sub Lblfond_Click()
End Sub
Private Sub UserForm_Initialize()
CBCompany.RowSource = "Comp!ListComp"
LblError = " Veuillez remplir tout les champs "
CbCompR.RowSource = "Comp!Listcomp"
End Sub
Private Sub Button_cancel_Click()
Unload Me
End Sub
Private Sub CbClear_Click()
Txt_Nom.Value = ""
Txt_Prenom.Value = ""
CBCompany = ""
TxtNameOTher.Value = ""
TXT_NID = ""
Me.Txt_Nom.SetFocus
End Sub
Private Sub BtWorker_Click()
Dim a As Range
Set a = Comp.Range("ListComp").Find(CBCompany.Value)
If Len(Me.CBCompany) = 0 Then
Me.LblError = "Choice Company"
Me.CBCompany.SetFocus
ElseIf Len(Me.Txt_Nom) = 0 Then
Me.LblError = "Enter a last name"
Me.Txt_Nom.SetFocus
ElseIf Len(Me.Txt_Prenom) = 0 Then
Me.LblError = "Enter a Name"
Me.Txt_Prenom.SetFocus
ElseIf Len(Me.TXT_NID) = 0 Then
Me.LblError = "Enter ID number"
Else
Sheets("Comp").Activate
Select Case a
Case "ATALIAN"
Range("B10").Select
Case "VEOLIA"
Range("H10").Select
Case "BRUNONIELS"
Range("N10").Select
Case "SIPWELL"
Range("T10").Select
Case "OTHERS"
Range("Z10").Select
End Select
Selection.End(xlDown).Select
Selection.Offset(1, 0).Select
ActiveCell = ActiveCell.Offset(-1, 0).Value + 1
ActiveCell.Offset(0, 1).Value = Txt_Nom & " " & Txt_Prenom
ActiveCell.Offset(0, 2).Value = Txt_Nom
ActiveCell.Offset(0, 3).Value = Txt_Prenom
ActiveCell.Offset(0, 4).Value = TXT_NID
If CBCompany = "OTHERS" Then
ActiveCell.Offset(0, 5).Value = TxtNameOTher
End If
Range("AG10").Select
Selection.End(xlDown).Select
Selection.Offset(1, 0).Select
ActiveCell = ActiveCell.Offset(-1, 0).Value + 1
ActiveCell.Offset(0, 1).Value = Txt_Nom & " " & Txt_Prenom
ActiveCell.Offset(0, 2).Value = TXT_NID
Report.Activate
Unload Me
End If
End Sub
Private Sub CbCompR_Change()
affichage_NameIn
End Sub
Private Sub affichage_NameIn()
Dim Mc As Range
Set Mc = Comp.Range("ListComp").Find(CbCompR.Value)'c'est ici que vient mettre une erreur le debugger
If Not Mc Is Nothing Then CbWorkerR.RowSource = "Comp!" & Mc.Offset(0, 1).Value
End Sub
Private Sub BtnClose_Click()
Unload Me
End Sub
Private Sub btnClear_Click()
CbCompR = ""
CbWorkerR = ""
End Sub
Private Sub BtnDel_Click()
If Len(CbCompR.Value) = 0 Then
Me.LblError1 = "Select Company"
Me.CbCompR.SetFocus
ElseIf Len(CbWorkerR.Value) = 0 Then
Me.LblError1 = "Select Worker"
Me.CbWorkerR.SetFocus
Else
Dim Valid As Byte
Valid = MsgBox("Are you sure to delete this Worker " & CbWorkerR.Value & " ?", vbCritical + vbYesNo, "Verification")
If (Valid = 7) Then
CbCompR = ""
CbWorkerR = ""
Exit Sub
Else
Dim a As Range
Set a = Comp.Range("ListComp").Find(CbCompR.Value)
Dim Lig As Integer
Lig = Selection.Row
Sheets("Comp").Activate
Select Case a
Case "ATALIAN"
Range("ListAtalian").Find(CbWorkerR.Value).Select
Lig = Selection.Row
Selection.ListObject.ListRows(Lig - 10).Delete
Case "VEOLIA"
Range("ListVeolia").Find(CbWorkerR.Value).Select
Lig = Selection.Row
Selection.ListObject.ListRows(Lig - 10).Delete
Case "BRUNONIELS"
Range("ListBrunoniels").Find(CbWorkerR.Value).Select
Lig = Selection.Row
Selection.ListObject.ListRows(Lig - 10).Delete
Case "SIPWELL"
Range("ListSipwell").Find(CbWorkerR.Value).Select
Lig = Selection.Row
Selection.ListObject.ListRows(Lig - 10).Delete
Case "OTHERS"
Range("ListOthers").Find(CbWorkerR.Value).Select
Lig = Selection.Row
Selection.ListObject.ListRows(Lig - 10).Delete
End Select
End If
End If
End SubPLS help je suis perdu j'ai beau essaie de mettre un unload apres le delete que ca sois dans le case ou dans le if rien n'y fait le formulaire ne se ferme pas donc pas moyen de refresh non plus la combobox
Bonsoir,
hummm ?!
Comme ça je ne voit pas... Qui d'autre ?
@ bientôt
LouReeD
h
c'est bien ca le problème
Comme qui dirait : Le fichier KI VA BI1 ?
@ bientôt
LouReeD
h
j'ai trouver en fait il suffisait de trouver ou Clear la combobox avant de delete sinon apparemment ca faisait erreur de chargement
Select Case a
Case "ATALIAN"
Range("ListAtalian").Find(CbWorkerR.Value).Select
CbCompR.Value = ""
Lig = Selection.Row
Selection.ListObject.ListRows(Lig - 10).Delete
If MsgBox("The worker as delete", vbOKOnly, "Confirm") = vbOK Then Unload Me
Case "VEOLIA"
Range("ListVeolia").Find(CbWorkerR.Value).Select
CbCompR.Value = ""
Lig = Selection.Row
Selection.ListObject.ListRows(Lig - 10).Delete
If MsgBox("The worker as delete", vbOKOnly, "Confirm") = vbOK Then Unload Me
Case "BRUNONIELS"
Range("ListBrunoniels").Find(CbWorkerR.Value).Select
CbCompR.Value = ""
Lig = Selection.Row
Selection.ListObject.ListRows(Lig - 10).Delete
If MsgBox("The worker as delete", vbOKOnly, "Confirm") = vbOK Then Unload Me
Case "SIPWELL"
Range("ListSipwell").Find(CbWorkerR.Value).Select
CbCompR.Value = ""
Lig = Selection.Row
Selection.ListObject.ListRows(Lig - 10).Delete
If MsgBox("The worker as delete", vbOKOnly, "Confirm") = vbOK Then Unload Me
Case "OTHERS"
Range("ListOthers").Find(CbWorkerR.Value).Select
CbCompR.Value = ""
Lig = Selection.Row
Selection.ListObject.ListRows(Lig - 10).Delete
If MsgBox("The worker as delete", vbOKOnly, "Confirm") = vbOK Then Unload Me
End SelectBonsoir,
merci pour ce retour, et désolé pour le retard du mien !
@ bientôt
LouReeD