C
cheriyo
Guest
bonjour,
Je me suis fait aider pour selectionner dans une USERFORM des données issues d'une base de données.
j'ai appliquer le code suivant et un message d'erreur apparait
help me please
Private Sub CmbSortir_Click()
Unload Me
End Sub
Private Sub TxtDanger_Change()
End Sub
Private Sub UserForm_Initialize()
Dim cell As Range
With Sheets("repdip")
'boucle sur la ligne num cas'
For Each cell In .Range("B3:B" & .Range("A65536").End(xlUp).Row)
ComboNom.AddItem (cell)
Next
End With
End Sub
Private Sub ComboNom_Change()
'nommer les outils de la userform pour afficher automatiquement le contenu'
With Sheets("repdip")
TxtNumCas = Cells(ComboNom.ListIndex + 3, 1)
TxtDanger = Cells(ComboNom.ListIndex + 3, 121)
TxtPhysique = Cells(ComboNom.ListIndex + 3, 122)
TxtEnvironnement = Cells(ComboNom.ListIndex + 3, 123)
End With
End Sub
Private Sub CmbInserer_Click()
'cest ici que ca bogue .....
Dim PremièreLigneVide As Long
With Sheets("Synthèse")
PremièreLigneVide = .Range("A65536").End(xlUp).Row + 1
.Cells(PremièreLigneVide, 2) = ComboNom
.Cells(PremièreLigneVide, 1) = CLng(TxtNumCas)
.Cells(PremièreLigneVide, 4) = CInt(TxtDanger)
.Cells(PremièreLigneVide, 4) = CInt(TxtPhysique)
.Cells(PremièreLigneVide, 5) = CInt(TxtEnvironnement)
MsgBox "transfert effectué"
End With
End Sub
Je me suis fait aider pour selectionner dans une USERFORM des données issues d'une base de données.
j'ai appliquer le code suivant et un message d'erreur apparait
help me please
Private Sub CmbSortir_Click()
Unload Me
End Sub
Private Sub TxtDanger_Change()
End Sub
Private Sub UserForm_Initialize()
Dim cell As Range
With Sheets("repdip")
'boucle sur la ligne num cas'
For Each cell In .Range("B3:B" & .Range("A65536").End(xlUp).Row)
ComboNom.AddItem (cell)
Next
End With
End Sub
Private Sub ComboNom_Change()
'nommer les outils de la userform pour afficher automatiquement le contenu'
With Sheets("repdip")
TxtNumCas = Cells(ComboNom.ListIndex + 3, 1)
TxtDanger = Cells(ComboNom.ListIndex + 3, 121)
TxtPhysique = Cells(ComboNom.ListIndex + 3, 122)
TxtEnvironnement = Cells(ComboNom.ListIndex + 3, 123)
End With
End Sub
Private Sub CmbInserer_Click()
'cest ici que ca bogue .....
Dim PremièreLigneVide As Long
With Sheets("Synthèse")
PremièreLigneVide = .Range("A65536").End(xlUp).Row + 1
.Cells(PremièreLigneVide, 2) = ComboNom
.Cells(PremièreLigneVide, 1) = CLng(TxtNumCas)
.Cells(PremièreLigneVide, 4) = CInt(TxtDanger)
.Cells(PremièreLigneVide, 4) = CInt(TxtPhysique)
.Cells(PremièreLigneVide, 5) = CInt(TxtEnvironnement)
MsgBox "transfert effectué"
End With
End Sub