Re : erreur espace insuffisant pour traiter cette commande
désolé
le code du haut est celui qui fonctionne,le mauvais est celui-là:
Option Explicit
Private Sub ajouter_Click()
Dim ligne As Long
ligne = Sheets(ComboBox3.Text).[A65000].End(xlUp).Offset(1, 0).Row
With Sheets(ComboBox3.Text)
.Cells(ligne, 1) = Me.TextBox3
.Cells(ligne, 2) = Me.TextBox4
.Cells(ligne, 3) = Me.TextBox5
.Cells(ligne, 4) = Me.TextBox7
End With
Unload Me
stocks.Show
End Sub
Private Sub annuler_Click()
Unload Me
stocks.Show
End Sub
Private Sub ComboBox1_Change()
Dim C As Range
ComboBox2.Clear
With Sheets(ComboBox1.Text)
For Each C In .Range("A6:A" & .Cells(.Rows.Count, "A").End(xlUp).Row)
ComboBox2.AddItem C
Next
End With
ComboBox2 = ""
End Sub
Private Sub ComboBox2_Change()
TextBox1 = Sheets(ComboBox1.Text).Cells(ComboBox2.ListIndex + 6, "E")
End Sub
Private Sub enregistrer_Click()
With Sheets("RECAP.MATERIEL")
.Range("A4").Value = TextBox6.Value
End With
Application.Dialogs(xlDialogSaveAs).Show
End Sub
Private Sub imprimer_Click()
With Sheets("RECAP.MATERIEL")
.Range("A4").Value = TextBox6.Value
End With
Sheets(Array("RECAP.MATERIEL", "Affuteuse", "A38", "A45", "Barqueteuse", "Calibreuse", "Compresseur", "Electricité", "Meca S2000", "automac", "Imprimante", "Karcher", "Ligne aérienne", "Multivac", "Peleuse maja", "Peleuse weber", "Poussoir Alpina", "Poussoir Frey", "Roulement", "Scie", "Tranchex", "Transpalette", "palga", "divers")).PrintOut
End Sub
Private Sub TextBox1_Change()
If Val(TextBox1) < 3 Then
MsgBox "ATTENTION STOCK INSUFFISANT A COMMANDER!!!!!", vbCritical, "ATTENTION!!!!!!!!!"
End If
End Sub
Private Sub TextBox2_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
If InStr("0123456789", Chr(KeyAscii)) = 0 Then KeyAscii = 0
End Sub
Private Sub Valider_Click()
If OptionButton2 And Val(TextBox2) > Val(TextBox1) Then
MsgBox "valeur refusée !", vbCritical, "Attention, stock insuffisant"
TextBox2 = ""
Exit Sub
End If
With Sheets(ComboBox1.Text).Cells(ComboBox2.ListIndex + 6, "E")
.Value = Sheets(ComboBox1.Text).Cells(ComboBox2.ListIndex + 6, "E") - Val(TextBox2) * OptionButton1 + Val(TextBox2) * OptionButton2
End With
Unload Me
stocks.Show
End Sub
Private Sub fermer_Click()
ActiveWorkbook.Close True
Unload Me
End Sub
Private Sub ComboBox3_Change()
Dim C As Range
ComboBox4.Clear
With Sheets(ComboBox3.Text)
For Each C In .Range("A6:A" & .Cells(.Rows.Count, "A").End(xlUp).Row)
ComboBox4.AddItem C
Next
End With
ComboBox4 = ""
End Sub
encore désolé