Erreur d'exécution 6 dépassement de capacité

Dams7700

XLDnaute Nouveau
Bonjour,

Je m'adresse au forum pour un nouveau soucis.

Mon programme tournait à merveille jusqu'à ce message d'erreur:

Erreur d'exécution 6

Dépassement de capacité

J'ai déjà un peu fouillé et essayé de remplacer les variables As integer en As double ou As long mais rien n'y fait.

Je suis un peu désemparé face à ce problème. qqun peut-il m'aider?

(Il m'est impossible d'envoyer le fichier en pièce jointe car trop gros, mais je peux l'envoyer par mail)

Merci d'avance :)
 

adel53

XLDnaute Occasionnel
Re : Erreur d'exécution 6 dépassement de capacité

Bonjour
A mon avis tu as déclarer une variable pas adapté à ton besoin par exemple en integer alors que tu as besoin de plus de place.
Tu peux uploader le fichier sur cijoint.com
 

Misange

XLDnaute Barbatruc
Re : Erreur d'exécution 6 dépassement de capacité

Bonjour

Pour t'assurer que le problème ne vient pas de la déclaration de tes variables, le plus simple : tu commentes les lignes de code contenant les déclarations de variables, sauf celles concernant les arrays qui sont obligatoires et tu enlèves bien sur option explicit en tête de module. Si ton code tourne c'est qu'une des variables est mal déclarées. Décommente une à une les déclarations et trouve celle qui coince.
 

Dams7700

XLDnaute Nouveau
Re : Erreur d'exécution 6 dépassement de capacité

Mon code est assez conséquent mais le voila:

Merci d'avance sur vos réponses je jette un coup d'oeil :)

code:

Dim bd, f
Dim TAbTemp As Variant
Dim bd2, f2
Dim TAbTemp2 As Variant


Private Sub UserForm_Initialize()
Set f = Sheets("BD")
Set d = CreateObject("Scripting.Dictionary")
Set bd = f.Range("D2:M" & f.[M65000].End(xlUp).Row)
For i = 1 To bd.Rows.Count
If bd.Cells(i, 1) <> "" Then d(bd.Cells(i, 1).Value) = ""
Next i
temp = d.keys
Me.ComboBox1.List = temp
Me.ListBox1.List = bd.Value
For K = 1 To 9: Me("label" & K).Caption = f.Cells(1, K): Next K

Dim L As Long
With Sheets("bd")
L = .Range("A65536").End(xlUp).Row
TAbTemp = .Range(.Cells(1, 1), .Cells(L, 3)).Value
End With
'------------------------------------------------------------------
Set f2 = Sheets("BD2")
Set d = CreateObject("Scripting.Dictionary")
Set bd2 = f2.Range("D2:M" & f.[M65000].End(xlUp).Row)
For i = 1 To bd2.Rows.Count
If bd2.Cells(i, 1) <> "" Then d(bd2.Cells(i, 1).Value) = ""
Next i
temp = d.keys

Me.ComboBox2.List = temp
Me.ListBox2.List = bd2.Value


Dim M As Long
With Sheets("bd2")
M = .Range("A65536").End(xlUp).Row
TAbTemp2 = .Range(.Cells(1, 1), .Cells(M, 3)).Value

End With
'---------------------------------------------------------------------------------------
K = 0
With Sheets("BD2")
For i = 2 To .[A65000].End(xlUp).Row
If .Cells(i, 13) < 1 Then
Me.ListBox3.AddItem
Me.ListBox3.List(K, 0) = .Cells(i, 4)
Me.ListBox3.List(K, 1) = .Cells(i, 5)
Me.ListBox3.List(K, 2) = .Cells(i, 6)
K = K + 1
End If
Next i
End With

'-------------------------------------------------------------------------------------------
K = 0
With Sheets("BD")

For i = 2 To .[A65000].End(xlUp).Row
datduJour = Date

If .Cells(i, 10) < Format(datduJour, "dd/mm/yyyy") Then 'Cells(1, 16)
Me.ListBox4.AddItem
Me.ListBox4.List(K, 0) = .Cells(i, 4)
Me.ListBox4.List(K, 1) = .Cells(i, 5)
Me.ListBox4.List(K, 2) = .Cells(i, 6)
Me.ListBox4.List(K, 3) = .Cells(i, 7)
Me.ListBox4.List(K, 4) = .Cells(i, 8)
Me.ListBox4.List(K, 5) = .Cells(i, 9)
Me.ListBox4.List(K, 6) = .Cells(i, 10)
Me.ListBox4.List(K, 7) = .Cells(i, 11)
Me.ListBox4.List(K, 9) = .Cells(i, 13)
K = K + 1
End If
Next i
End With

'Charger manuellement le combobox
secteur.AddItem "Bacteriologie"
secteur.AddItem "Virologie"
secteur.AddItem "LRS"
secteur.AddItem "Sero-Viro"
secteur2.AddItem "Bacteriologie"
secteur2.AddItem "Virologie"
secteur2.AddItem "LRS"
secteur2.AddItem "Sero-Viro"

End Sub
Private Sub ComboBox1_Click()
Dim a()
N = Application.CountIf(Application.Index(bd, , 1), Me.ComboBox1)
ReDim a(1 To N, 1 To bd.Columns.Count)
ligne = 0
For i = 1 To bd.Rows.Count
If bd.Cells(i, 1) = Me.ComboBox1 Then
ligne = ligne + 1
For K = 1 To bd.Columns.Count: a(ligne, K) = bd.Cells(i, K): Next K
End If
Next i
Me.ListBox1.List = a()
Me.TextBox1.Value = Me.ComboBox1.Text


End Sub

Private Sub secteur_Change()

Dim TabSansDoublon As New Collection
Dim L As Long
On Error Resume Next
For L = 1 To UBound(TAbTemp, 1)
If TAbTemp(L, 1) = secteur.Text Then
TabSansDoublon.Add TAbTemp(L, 2), CStr(TAbTemp(L, 2))
End If
Next L
On Error GoTo 0

fournisseur.Clear
For L = 1 To TabSansDoublon.Count
fournisseur.AddItem TabSansDoublon(L)
Next L
ComboBox1.Clear

End Sub

Private Sub fournisseur_Change()

Dim TabSansDoublon As New Collection
Dim L As Long
On Error Resume Next
For L = 1 To UBound(TAbTemp, 1)
If TAbTemp(L, 2) = fournisseur.Text Then
TabSansDoublon.Add TAbTemp(L, 3), CStr(TAbTemp(L, 3))
End If
Next L
On Error GoTo 0
ComboBox1.Clear
For L = 1 To TabSansDoublon.Count
ComboBox1.AddItem TabSansDoublon(L)
Next L

End Sub


Private Sub CommandButton1_Click()


Sheets("BD").Range("a65536").End(xlUp).Offset(1, 0) = Me.secteur.Value
Sheets("BD").Range("b65536").End(xlUp).Offset(1, 0) = Me.fournisseur.Value
Sheets("BD").Range("c65536").End(xlUp).Offset(1, 0) = Me.ComboBox1.Value
Sheets("BD").Range("d65536").End(xlUp).Offset(1, 0) = Me.TextBox1.Value
Sheets("BD").Range("e65536").End(xlUp).Offset(1, 0) = Me.TextBox2.Value
Sheets("BD").Range("f65536").End(xlUp).Offset(1, 0) = Me.TextBox3.Value
Sheets("BD").Range("g65536").End(xlUp).Offset(1, 0) = Me.TextBox4.Value
Sheets("BD").Range("h65536").End(xlUp).Offset(1, 0) = Me.TextBox5.Value
Sheets("BD").Range("i65536").End(xlUp).Offset(1, 0) = Me.TextBox6.Value
Sheets("BD").Range("j65536").End(xlUp).Offset(1, 0) = Me.TextBox7.Value
Sheets("BD").Range("k65536").End(xlUp).Offset(1, 0) = Me.TextBox8.Value
Sheets("BD").Range("l65536").End(xlUp).Offset(1, 0) = Me.TextBox9.Value
Sheets("BD").Range("m65536").End(xlUp).Offset(1, 0) = Me.TextBox10.Value

For i = 1 To 10
Me.Controls("TextBox" & i).Value = "x"


Next i
MsgBox "Votre saisie est réussie", vbOKOnly + vbInformation, "Saisie réussie"

Unload Recherche
Recherche.Show



End Sub

Private Sub ListBox1_Change()

TextBox2 = ListBox1.List(ListBox1.ListIndex, 1)
TextBox3 = ListBox1.List(ListBox1.ListIndex, 2)
TextBox4 = ListBox1.List(ListBox1.ListIndex, 3)
TextBox5 = ListBox1.List(ListBox1.ListIndex, 4)
TextBox9 = ListBox1.List(ListBox1.ListIndex, 8)
TextBox6 = ListBox1.List(ListBox1.ListIndex, 5)
TextBox7 = ListBox1.List(ListBox1.ListIndex, 6)
TextBox8 = ListBox1.List(ListBox1.ListIndex, 7)
TextBox10 = ListBox1.List(ListBox1.ListIndex, 9)


End Sub

Private Sub CommandButton2_Click()
Sheets("BD").Cells(TextBox9, 9).Value = Me.TextBox6.Text

Sheets("BD").Cells(TextBox9, 10).Value = Me.TextBox7.Text
Sheets("BD").Cells(TextBox9, 11).Value = Me.TextBox8.Text
Sheets("BD").Cells(TextBox9, 13).Value = Me.TextBox10.Text

ListBox1.List(ListBox1.ListIndex, 5) = TextBox6.Text
ListBox1.List(ListBox1.ListIndex, 6) = TextBox7.Text
ListBox1.List(ListBox1.ListIndex, 7) = TextBox8.Text
ListBox1.List(ListBox1.ListIndex, 9) = TextBox10.Text



End Sub



Private Sub secteur2_Change()

Dim TabSansDoublon As New Collection
Dim L As Long

On Error Resume Next
For L = 1 To UBound(TAbTemp2, 1)
If TAbTemp2(L, 1) = secteur2.Text Then

TabSansDoublon.Add TAbTemp2(L, 2), CStr(TAbTemp2(L, 2))
End If
Next L
On Error GoTo 0

fournisseur2.Clear
For L = 1 To TabSansDoublon.Count
fournisseur2.AddItem TabSansDoublon(L)
Next L

ComboBox2.Clear

End Sub

Private Sub fournisseur2_Change()

Dim TabSansDoublon As New Collection
Dim L As Long
On Error Resume Next
For L = 1 To UBound(TAbTemp, 1)
If TAbTemp2(L, 2) = fournisseur2.Text Then
TabSansDoublon.Add TAbTemp2(L, 3), CStr(TAbTemp2(L, 3))
End If
Next L
On Error GoTo 0
ComboBox2.Clear
For L = 1 To TabSansDoublon.Count
ComboBox2.AddItem TabSansDoublon(L)
Next L

End Sub
Private Sub ComboBox2_Click()

Dim a() As Double

N = Application.CountIf(Application.Index(bd2, , 1), Me.ComboBox2)
ReDim a(1 To N, 1 To bd2.Columns.Count)
ligne = 0
For i = 1 To bd2.Rows.Count
If bd2.Cells(i, 1) = Me.ComboBox2 Then
ligne = ligne + 1
For K = 1 To bd2.Columns.Count: a(ligne, K) = bd2.Cells(i, K): Next K
End If
Next i
Me.ListBox2.List = a()

Me.TextBox16.Value = Me.ComboBox2.Text
End Sub
Private Sub ListBox2_change()

TextBox17 = ListBox2.List(ListBox2.ListIndex, 7)
TextBox11 = ListBox2.List(ListBox2.ListIndex, 8)

End Sub
Private Sub CommandButton3_Click()


Sheets("BD2").Cells(TextBox11, 11).Value = Me.TextBox17.Text
ListBox2.List(ListBox2.ListIndex, 7) = TextBox17.Text

End Sub
Private Sub CommandButton4_Click()
MsgBox "Liste des articles à commander actualisée", vbOKOnly + vbInformation, "Saisie réussie"
Unload Recherche
Recherche.Show

End Sub
Private Sub CommandButton5_Click()
Dim Tableau() As Variant
Dim i As Integer
Dim j As Byte

Application.ScreenUpdating = False
Workbooks.Add 'création d'un nouveau classeur temporaire

Tableau() = ListBox3.List
j = ListBox3.ColumnCount
i = ListBox3.ListCount
Range("A1:" & Cells(i, j).Address) = Tableau()

'option pour adapter la largeur des colonnes à la taille des données
ActiveSheet.Range("A1:" & Cells(i, j).Address).EntireColumn.AutoFit

ActiveWorkbook.PrintOut 'impression
ActiveWorkbook.Close False 'suppression du classeur temporaire
Application.ScreenUpdating = True

End Sub
Private Sub CommandButton6_Click()
ActiveWorkbook.FollowHyperlink Address:="http://septantesix3/MAN_QUAL/Manuel_New/Chapitre_6/listes/produits/Commandes/SAP_Login.idc"
End Sub

Private Sub CommandButton7_Click()

MsgBox "Liste des réactifs périmés a été actualisée", vbOKOnly + vbInformation, "Saisie réussie"
Unload Recherche
Recherche.Show

End Sub

Private Sub CommandButton9_Click()
ActiveWorkbook.FollowHyperlink Address:="G:\Microbiologie\LMM\LMM\Qualité\Gestion stocks\BAC_MOLECULAIRE\03_07_00_06_004_F002_TRACABILITE MICROBIOLOGIE MOLECULAIRE Pièce ADNARN Free.xls"
Unload Recherche
End Sub
Private Sub CommandButton10_Click()
ActiveWorkbook.FollowHyperlink Address:="G:\Microbiologie\LMM\LMM\Qualité\Gestion stocks\BAC_MOLECULAIRE\03_07_00_06_004_F003_TRACABILITE MICROBIOLOGIE MOLECULAIRE Extraction & clivage PFGE.xls"
Unload Recherche
End Sub
Private Sub CommandButton8_Click()
ActiveWorkbook.FollowHyperlink Address:="G:\Microbiologie\LMM\LMM\Qualité\Gestion stocks\BAC_MOLECULAIRE\03_07_00_06_004_F004_TRACABILITE MATERIEL MICROBIOLOGIE MOLECULAIRE post_PCR.xls"
Unload Recherche
End Sub
Private Sub CommandButton11_Click()
ActiveWorkbook.FollowHyperlink Address:="G:\Microbiologie\LMM\LMM\Qualité\Gestion stocks\BAC_MOLECULAIRE\03_07_01_09_001_F005_Récapitulatif traçabilité bactériologie moléculaire.xls"
Unload Recherche
End Sub
 

Dams7700

XLDnaute Nouveau
Re : Erreur d'exécution 6 dépassement de capacité

D'accord, Un enorme merci en tout cas de déjà te pencher sur mon pbl
je penchais pour qqch dans ce sens la aussi et je me demandais, vu que je n'utiliserai jamais plus de 20.000 lignes (grand max) il ne serait pas possible de limiter le classeur à ces 20.000 lignes tout en gardant le même code, et est ce que cela pourrait résoudre mon pbl éventuellement...

et dsl si le code est un peu brouillon...
 

Dams7700

XLDnaute Nouveau
Re : Erreur d'exécution 6 dépassement de capacité

Je viens de remarquer qqch de très bête, la scrolbar verticale de l'onglet BD ne s'adapte pas automatiquement aux données présentes dans la feuille.... il reste figé comme ci il y avait des entrées jusquà la ligne 65536....
 

Discussions similaires

Statistiques des forums

Discussions
312 388
Messages
2 087 876
Membres
103 672
dernier inscrit
ammarhouichi