Temps enregistrement formulaire userform trop long
Bonjour à tous,
J'ai un Excel avec une formulaire contenant 110 informations a compléter et le temps d'enregistrement est de 3 min. comment faire pour réduire ce temps?
Merci pour votre aide,
Cordialement,
Bonjour,
Tu pourrais commencer par fournir ton UserForm (avec au moins un enregistrement dans ta BD.)
A+
Bonjour,
ne pas inscrire donnée par donnée sur la feuille mais remplir un tableau que tu inscris en une fois.
Ex si les données sont sur 1 ligne :
Dim datas(1 To 1, 1 To 110)
datas(1, 1) = "abc"
datas(1, 2) = 3
datas(1, 3) = 1254
' etc
[A11].Resize(UBound(datas, 1), UBound(datas, 2)) = datassi elles sont dispersées à faire sur autant de plages disjointes en en ayant le moins possible.
Ca peut faire du x100...
eric
Bonjour à tous,
j'ai plusieurs onglets avec des données sont enregistrées avec le formulaire et dans d'autres des recherchev liés a ses onglets. ce qui se produit, c'est que le fichier 'calcul', calcul', pendant 3 min. ci-joint la macro que j'utilise.
Merci pour votre aide.
Je te laisse entre de bonnes mains : Visiblement tu n'as pas trop envie de montrer ton travail et notre ami Eric à un fort pouvoir de divination !
A+
Alors pas du tout.
Ma boule de cristal ne me laisse voir que de la neige sur l'arc de triomphe, j'ai dû me faire avoir.
Même sans elle, je vois bien que mon petit laïus n'a pas intéressé du tout notre ami...
Pas grave. Il y a bien un spécialiste de word qui passera dans le coin
Pour la route (une tentative un peu incrédule...) Bien sur je n'ai aucune idée de ce que ça peu apporter, ni même si ça fonctionne puisque je ne peux pas tester.
D'ailleurs je ne conseillerai à personne de programmer comme ça, mébon puisque c'est toi qui est dans cte galère, à toi de ramer maintenant !
Option Explicit
Private Sub btnfer_Click()
Unload Me
End Sub
Private Sub btnssdata1_Click()
Sheets("Dat").Activate 'dat1 - dat2
Range("A1").Select
End Sub
Sub RemplacerTextBoxVidesParZero()
Dim Ctrl As Control
For Each Ctrl In Me.Controls
If TypeOf Ctrl Is MSFormsBox Then
If Trim(Ctrl) = "" Then Ctrl = "0.00"
If InStr(Ctrl, ",", 1) > 0 Then Ctrl = Replace(Ctrl, ",", ".")
End If
Next Ctrl
End Sub
Private Sub btnsEffacer_Click()
Dim Ctrl As Control
For Each Ctrl In Me.Controls
If TypeOf Ctrl Is MSFormsBox Then Ctrl.value = ""
Next
For Each Ctrl In Me.Controls
If TypeOf Ctrl Is MSForms.ComboBox Then Ctrl.value = ""
Next
End Sub
Private Sub btns_Click()
Dim k&
RemplacerTextBoxVidesParZero
With Sheets("DAT")
.Activate
k = .Range("A1").End(xlDown).Row + 1
.Cells(k, 1) = CDate(Me.txtdata) 'date
.Cells(k, 2) = Me.cbot1
.Cells(k, 3) = Me.cboth1
.Cells(k, 4) = Me.cbotf1
.Cells(k, 5) = Val(Me.txtf1)
.Cells(k, 6) = Val(Me.txtm1)
.Cells(k, 7) = Val(Me.txtr1)
.Cells(k, 8) = Val(Me.txtp1)
.Cells(k, 9) = Val(Me.txtn1)
.Cells(k, 10) = Val(Me.txtt1)
.Cells(k, 11) = Val(Me.txtq1)
.Cells(k, 12) = Val(Me.txth1)
.Cells(k, 13) = Val(Me.txte1)
.Cells(k, 14) = Val(Me.txtv1)
.Cells(k, 15) = Me.cbolo1
.Cells(k, 16) = Me.cbolof1
.Cells(k, 17) = Me.cbolos1
.Cells(k, 18) = Me.cbolom1
.Cells(k, 19) = Me.cbolor1
.Cells(k, 20) = Me.cboloc1
.Cells(k, 21) = Me.cboloca1
.Cells(k, 22) = Me.cbolot1
.Cells(k, 23) = Me.cboloi1
.Cells(k, 24) = Me.cbolop1
.Cells(k, 35) = Me.cboth2
.Cells(k, 36) = Me.cbotf2
.Cells(k, 37) = Val(Me.txtf2)
.Cells(k, 38) = Val(Me.txtm2)
.Cells(k, 39) = Val(Me.txtr2)
.Cells(k, 40) = Val(Me.txtp2)
.Cells(k, 41) = Val(Me.txtn2)
.Cells(k, 42) = Val(Me.txtt2)
.Cells(k, 43) = Val(Me.txtq2)
.Cells(k, 44) = Val(Me.txth2)
.Cells(k, 45) = Val(Me.txte2)
.Cells(k, 46) = Val(Me.txtv2)
.Cells(k, 47) = Me.cbolo2
.Cells(k, 48) = Me.cbolof2
.Cells(k, 49) = Me.cbolos2
.Cells(k, 50) = Me.cbolom2
.Cells(k, 51) = Me.cbolor2
.Cells(k, 52) = Me.cboloc2
.Cells(k, 53) = Me.cboloca2
.Cells(k, 54) = Me.cbolot2
.Cells(k, 55) = Me.cboloi2
.Cells(k, 56) = Me.cbolop2
.Cells(k, 67) = Me.cboth3
.Cells(k, 68) = Me.cbotf3
.Cells(k, 69) = Val(Me.txtf3)
.Cells(k, 70) = Val(Me.txtm3)
.Cells(k, 71) = Val(Me.txtr3)
.Cells(k, 72) = Val(Me.txtp3)
.Cells(k, 73) = Val(Me.txtn3)
.Cells(k, 74) = Val(Me.txtt3)
.Cells(k, 75) = Val(Me.txtq3)
.Cells(k, 76) = Val(Me.txth3)
.Cells(k, 77) = Val(Me.txte3)
.Cells(k, 78) = Val(Me.txtv3)
.Cells(k, 79) = Me.cbolo3
.Cells(k, 80) = Me.cbolof3
.Cells(k, 81) = Me.cbolos3
.Cells(k, 82) = Me.cbolom3
.Cells(k, 83) = Me.cbolor3
.Cells(k, 84) = Me.cboloc3
.Cells(k, 85) = Me.cboloca3
.Cells(k, 86) = Me.cbolot3
.Cells(k, 87) = Me.cboloi3
.Cells(k, 88) = Me.cbolop3
.Cells(k, 99) = Me.cboth4
.Cells(k, 100) = Me.cbotf4
.Cells(k, 101) = Val(Me.txtf4)
.Cells(k, 102) = Val(Me.txtm4)
.Cells(k, 103) = Val(Me.txtr4)
.Cells(k, 104) = Val(Me.txtp4)
.Cells(k, 105) = Val(Me.txtn4)
.Cells(k, 106) = Val(Me.txtt4)
.Cells(k, 107) = Val(Me.txtq4)
.Cells(k, 108) = Val(Me.txth4)
.Cells(k, 109) = Val(Me.txte4)
.Cells(k, 110) = Val(Me.txtv4)
.Cells(k, 111) = Me.cbolo4
.Cells(k, 112) = Me.cbolof4
.Cells(k, 113) = Me.cbolos4
.Cells(k, 114) = Me.cbolom4
.Cells(k, 115) = Me.cbolor4
.Cells(k, 116) = Me.cboloc4
.Cells(k, 117) = Me.cboloca4
.Cells(k, 118) = Me.cbolot4
.Cells(k, 119) = Me.cboloi4
.Cells(k, 120) = Me.cbolop5
.Cells(k, 131) = Me.cboth5
.Cells(k, 132) = Me.cbotf5
.Cells(k, 133) = Val(Me.txtf5)
.Cells(k, 134) = Val(Me.txtm5)
.Cells(k, 135) = Val(Me.txtr5)
.Cells(k, 136) = Val(Me.txtp5)
.Cells(k, 137) = Val(Me.txtn5)
.Cells(k, 138) = Val(Me.txtt5)
.Cells(k, 139) = Val(Me.txtq5)
.Cells(k, 140) = Val(Me.txth5)
.Cells(k, 141) = Val(Me.txte5)
.Cells(k, 142) = Val(Me.txtv5)
.Cells(k, 143) = Me.cbolo5
.Cells(k, 144) = Me.cbolof5
.Cells(k, 145) = Me.cbolos5
.Cells(k, 146) = Me.cbolom5
.Cells(k, 147) = Me.cbolor5
.Cells(k, 148) = Me.cboloc5
.Cells(k, 149) = Me.cboloca5
.Cells(k, 150) = Me.cbolot5
.Cells(k, 151) = Me.cboloi5
.Cells(k, 152) = Me.cbolop5
End With
MsgBox "ÎNREGISTRARE GATA", vbOKOnly + vbInformation, "REALIAZARE"
End Sub
Private Sub txtdata_change()
If txtdata <> "" Then
btns.Enabled = True
Else
btns.Enabled = False
End If
End SubA+