XL 2016 Aide excel lent

filtre69

XLDnaute Occasionnel
Bonjour @ tout le forum,

Voilà depuis j'essaie d'apprendre excel je commence à comprendre le Vba, là je viens de faire un fichier qui fonctionne mais il est lent pouvez-vous m'aider à comprendre où j'ai fait des erreurs de codage pour mieux comprendre.
Je vous joins le fichier.
Grand merci de votre aide et surtout de votre patience
Cordialement
 
Solution
C'est très simple, après With Cells(derligne, 1) :

a) .Value est la valeur de cette cellule, en colonne A : Nom

b) .Offset(, 1) = .Offset(0, 1) est la valeur de la cellule située sur la même ligne,
1 colonne à droite, donc en colonne B : Bureau

c) .Offset(, 2) = .Offset(0, 2) est la valeur de la cellule située sur la même ligne,
2 colonnes à droite, donc en colonne C : Model Machine

d) .Offset(, 3) = .Offset(0, 3) est la valeur de la...

filtre69

XLDnaute Occasionnel
Ma UserForm déjà

Private Sub BtAjouter_Click()
Dim derligne As Integer

If MsgBox("Confirmez-vous l'ajout de nouvelles données?", vbYesNo, "comfimation") = vbYes Then
derligne = Sheets("Gestion").Range("A65536").End(xlUp).Row + 1
Cells(derligne, 1) = ComboBox1.Value
Cells(derligne, 2) = ComboBox2.Value
Cells(derligne, 3) = ComboBox3.Value
Cells(derligne, 4) = ComboBox4.Value
Cells(derligne, 5) = ComboBox5.Value
Cells(derligne, 6) = ComboBox6.Value
Cells(derligne, 7) = ComboBox7.Value
Cells(derligne, 8) = ComboBox8.Value
Cells(derligne, 9) = TextBox1.Value
Cells(derligne, 10) = ComboBox9.Value
Cells(derligne, 11) = ComboBox10.Value
Cells(derligne, 12) = ComboBox11.Value
Cells(derligne, 13) = ComboBox12.Value
Cells(derligne, 14) = TextBox2.Value
Cells(derligne, 15) = TextBox3.Value
Cells(derligne, 16) = TextBox4.Value
End If
' ---------------------------------------------------------
Worksheets("GESTION").Range("A:p").Columns.AutoFit
Range("A6").CurrentRegion.Activate
Selection.Font.Bold = True
With Selection.Font
.Name = "Calibri"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ThemeColor = xlThemeColorLight1
.TintAndShade = 0
.ThemeFont = xlThemeFontMinor
End With
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With


' -------------------------------------------------------
Unload Me_saisie
Me_saisie.Show
End Sub
Private Sub BtAller_Click()
Dim no_ligne As Integer
no_ligne = ComboBox13.ListIndex + 6
ComboBox1.Value = Cells(no_ligne, 1).Value
ComboBox2.Value = Cells(no_ligne, 2).Value
ComboBox3.Value = Cells(no_ligne, 3).Value
ComboBox4.Value = Cells(no_ligne, 4).Value
ComboBox5.Value = Cells(no_ligne, 5).Value
ComboBox6.Value = Cells(no_ligne, 6).Value
ComboBox7.Value = Cells(no_ligne, 7).Value
ComboBox8.Value = Cells(no_ligne, 8).Value
TextBox1.Value = Cells(no_ligne, 9).Value
ComboBox9.Value = Cells(no_ligne, 10).Value
ComboBox10.Value = Cells(no_ligne, 11).Value
ComboBox11.Value = Cells(no_ligne, 12).Value
ComboBox12.Value = Cells(no_ligne, 13).Value
TextBox2.Value = Cells(no_ligne, 14).Value
TextBox3.Value = Cells(no_ligne, 15).Value
TextBox4.Value = Cells(no_ligne, 16).Value
End Sub
Private Sub BtModifier_Click()
Dim no_ligne As Integer
Sheets("GESTION").Select
no_ligne = ComboBox13.ListIndex + 6
If ComboBox1.Value = "" Then
MsgBox (" veuillez remplir le champs de la recherche!")
Else
Cells(no_ligne, 1) = ComboBox1.Value
Cells(no_ligne, 2) = ComboBox2.Value
Cells(no_ligne, 3) = ComboBox3.Value
Cells(no_ligne, 4) = ComboBox4.Value
Cells(no_ligne, 5) = ComboBox5.Value
Cells(no_ligne, 6) = ComboBox6.Value
Cells(no_ligne, 7) = ComboBox7.Value
Cells(no_ligne, 8) = ComboBox8.Value
Cells(no_ligne, 9) = TextBox1.Value
Cells(no_ligne, 10) = ComboBox9.Value
Cells(no_ligne, 11) = ComboBox10.Value
Cells(no_ligne, 12) = ComboBox11.Value
Cells(no_ligne, 13) = ComboBox12.Value
Cells(no_ligne, 14) = TextBox2.Value
Cells(no_ligne, 15) = TextBox3.Value
Cells(no_ligne, 16) = TextBox4.Value
MsgBox ("Modification effectuée")

Unload Me_saisie
Me_saisie.Show
End If
Exit Sub
End Sub
Private Sub BtQuitter_Click()
Unload Me_saisie
End Sub
Private Sub Btsup_Click()
If MsgBox("Confirmez-vous la suppression?", vbYesNo, "Demande de confirmation de suppression") = vbYes Then
Rows([A6:A65536].Find(ComboBox1.Value).Row).EntireRow.Delete
Unload Me_saisie
Me_saisie.Show
End If
End Sub
 

soan

XLDnaute Barbatruc
Inactif
C'est très simple, après With Cells(derligne, 1) :

a) .Value est la valeur de cette cellule, en colonne A : Nom

b) .Offset(, 1) = .Offset(0, 1) est la valeur de la cellule située sur la même ligne,
1 colonne à droite, donc en colonne B : Bureau

c) .Offset(, 2) = .Offset(0, 2) est la valeur de la cellule située sur la même ligne,
2 colonnes à droite, donc en colonne C : Model Machine

d) .Offset(, 3) = .Offset(0, 3) est la valeur de la cellule située sur la même ligne,
3 colonnes à droite, donc en colonne D : Model Ecran

etc...

(tout ça sur la ligne n° derligne)

soan
 

Discussions similaires

Statistiques des forums

Discussions
312 203
Messages
2 086 181
Membres
103 152
dernier inscrit
Karibu