[EXCEL-VBA]
Résolu/Fermé
A voir également:
- [EXCEL-VBA]
- Liste déroulante excel - Guide
- Si et excel - Guide
- Word et excel gratuit - Guide
- Déplacer une colonne excel - Guide
- Excel compter cellule couleur sans vba - Guide
25 réponses
code = huch... pourquoi pas starsky ???
Les fichiers où j'existe mes recherches sont identiques qu'auparavant!
mon code de recherche n'a pas été modifié, j'ai juste mis un if en plus... :S
Les fichiers où j'existe mes recherches sont identiques qu'auparavant!
mon code de recherche n'a pas été modifié, j'ai juste mis un if en plus... :S
Utilisateur anonyme
3 août 2005 à 16:42
3 août 2005 à 16:42
re :
code = huch... pourquoi pas starsky ???
ça veut dire quoi ?
Lupin
code = huch... pourquoi pas starsky ???
ça veut dire quoi ?
Lupin
Utilisateur anonyme
5 août 2005 à 09:44
5 août 2005 à 09:44
If Application.Workbooks(fichier(4)).Worksheets("Tableau").Cells(i, choix).Value = FormatDateTime(mot_clef)
çà marche!!!! incompréhensible!!!! parce que comme Lupin.Arsene a pu le voir, il n'y avait pas besoin de mettre çà dans le premier programme pour que çà marche! allez savoir pourquoi...
Merci, je vous tiens au courant pour la suite...
Utilisateur anonyme
3 août 2005 à 16:25
3 août 2005 à 16:25
Salut,
Ça ressemble à une incompatibilité de type !
Ce que je comprends :
Si tu code en dure une valeur "jj/mm/aaaa" ça fonctionne
Si tu récupère la valeur par une variable ça coince.
Est-ce j'ai bien compris ?
Lupin
Ça ressemble à une incompatibilité de type !
Ce que je comprends :
Si tu code en dure une valeur "jj/mm/aaaa" ça fonctionne
Si tu récupère la valeur par une variable ça coince.
Est-ce j'ai bien compris ?
Lupin
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question
:'(
Ca veut vraiment pas marcher alors qu'avant aucun souci!!!
Je veux essayer autre chose mais je ne sais pas comment le faire:
Faire en sotre que le mot clef soit déclarer comme le type désiré!!
Par exemple, si je fais une recherche par date, j'aimerais que le mot clef saisi soit défini du type jj/mm/aaaa en espérant que ce soit çà qui bloque tout...
Merci de faire comme moi et d'aider ceux qui ont du mal!!!
:'( :'( :'(
Ca veut vraiment pas marcher alors qu'avant aucun souci!!!
Je veux essayer autre chose mais je ne sais pas comment le faire:
Faire en sotre que le mot clef soit déclarer comme le type désiré!!
Par exemple, si je fais une recherche par date, j'aimerais que le mot clef saisi soit défini du type jj/mm/aaaa en espérant que ce soit çà qui bloque tout...
Merci de faire comme moi et d'aider ceux qui ont du mal!!!
:'( :'( :'(
Bon vous l'aurez voulu!!!!!!
1er programme :
2ème programme :
Dites moi ce qui différe l'un de l'autre mise à part les conditions if mode ="..." parce que là je vois pas ce qui fait merder mon programme!!!
1er programme :
Dim chemin, mot_clef As String Dim valid, lancement, fin, k, choix As Integer Dim ok As Boolean Dim fso, Dossier, Flder As Object Dim fichier Dim cellule As Integer Dim Msg1, Msg2, Style, Title, Box Dim nb, derniere_colonne Dim cellul As String Sub main() If lancement = 0 Then OptionButton1.Value = False OptionButton2.Value = False OptionButton3.Value = False OptionButton4.Value = False OptionButton5.Value = False OptionButton6.Value = False OptionButton7.Value = False choix = 0 lancement = 1 End If End Sub Private Sub erreur() mot_clef = Mot Msg1 = "Vous n'avez pas choisi de type de recherche!" Msg2 = "Vous n'avez saisi aucune recherche!" Style = vbOKOnly + vbExclamation Title = "Erreur!" valid = 0 If (choix = 0) Then Box = MsgBox(Msg1, Style, Title) ElseIf Mot = "" Then Box = MsgBox(Msg2, Style, Title) Else valid = 1 End If Mot = "" End Sub Function select_a_folder(message, directory) ok = False Const WINDOW_HANDLE = 0 Const NO_OPTIONS = 0 Set objShell = CreateObject("Shell.Application") Set objFolder = objShell.BrowseForFolder _ (WINDOW_HANDLE, message, NO_OPTIONS, directory) On Error Resume Next Set objFolderItem = objFolder.Self If Err <> 0 Then select_a_folder = "ANNUL" Else select_a_folder = objFolderItem.Path ok = True End If On Error GoTo 0 End Function Private Sub OptionButton1_Click() choix = 1 End Sub Private Sub OptionButton2_Click() choix = 3 End Sub Private Sub OptionButton3_Click() choix = 4 End Sub Private Sub OptionButton4_Click() choix = 4 End Sub Private Sub OptionButton5_Click() choix = 5 End Sub Private Sub OptionButton6_Click() choix = 6 End Sub Private Sub OptionButton7_Click() choix = 8 End Sub Private Sub Recherche_Click() erreur If valid = 1 Then chemin = select_a_folder("Veuillez sélectionner un dossier dans lequel s'effectuera la recherche par " & choix & " de " & Mot & "", "c:\Convoyeurs\EXCEL\") If ok = True Then Application.Workbooks("recherche.xls").Worksheets("Résultats").Range("A7:L65536").Clear Application.Workbooks("recherche.xls").Worksheets("listing").Cells.Clear lister chercher End If End If Application.Workbooks("recherche.xls").Worksheets("Résultats").Activate Application.Workbooks("recherche.xls").Worksheets("Résultats").Range("A" & k & "").Select MsgBox ("" & ((k - 7) / 4) & " résultat(s) trouvé(s)") End Sub Function chercher() k = 7 For cellule = 3 To (derniere_colonne + 2) fin = Application.Workbooks("recherche.xls").Worksheets("listing").Cells(65536, cellule).End(xlUp).Row For a = 1 To fin Workbooks.Open Feuil2.Cells(a, cellule).Value fichier = Split(Feuil2.Cells(a, cellule).Value, "\") LaDerniere = Application.Workbooks(fichier(4)).Worksheets("Tableau").Cells(65536, choix).End(xlUp).Row For i = 20 To LaDerniere If Application.Workbooks(fichier(4)).Worksheets("Tableau").Cells(i, choix).Value = mot_clef Then Application.Workbooks(fichier(4)).Worksheets("Tableau").Range("A" & i & ":L" & (i + 3) & "").Copy Application.Workbooks("recherche.xls").Worksheets("Résultats").Activate Application.Workbooks("recherche.xls").Worksheets("Résultats").Range("A" & k & "").Select ActiveSheet.Paste With Worksheets("Résultats") .Hyperlinks.Add .Range("A" & k & ""), Feuil2.Cells(a, cellule).Value End With k = k + 4 End If Next i Application.Workbooks(fichier(4)).Activate ActiveWorkbook.Close Next a Next cellule mot_clef = "" End Function Function lister() TousLesDossiers "" & chemin & "", 0 TousLesFichiers End Function Function TousLesDossiers(LeDossier$, Idx As Long) Set fso = CreateObject("Scripting.FileSystemObject") Set Dossier = fso.GetFolder(LeDossier) 'examen du dossier courant For Each Flder In Dossier.subfolders Idx = Idx + 1 Feuil2.Range("a" & Idx & "").Value = Flder.Path Next Set fso = Nothing End Function 'fs Function TousLesFichiers() Set fs = Application.FileSearch If Feuil2.Range("A1").Value = "" Then Feuil2.Range("A1").Value = Dossier derniere_colonne = 1 Else derniere_colonne = 4 End If For F = 1 To derniere_colonne With fs .LookIn = "" & Feuil2.Range("A" & F & "").Value & "" .Filename = "*" .Execute For i = 1 To .FoundFiles.Count If F = 1 Then cellul = "C" ElseIf F = 2 Then cellul = "D" ElseIf F = 3 Then cellul = "E" ElseIf F = 4 Then cellul = "F" End If Feuil2.Range("" & cellul & "" & i & "").Value = .FoundFiles(i) Next i If .FoundFiles.Count = 0 Then MsgBox "Aucun fichier n'a été trouvé." End If End With Next F End Function
2ème programme :
Dim chemin, mot_clef, mode As String Dim valid, lancement, fin, k, choix As Integer Dim ok As Boolean Dim fso, Dossier, Flder As Object Dim fichier Dim cellule As Integer Dim Msg1, Msg2, Style, Title, Box Dim nb, derniere_colonne Dim cellul As String Sub main() If lancement = 0 Then OptionButton1.Value = False OptionButton2.Value = False OptionButton3.Value = False OptionButton4.Value = False OptionButton5.Value = False OptionButton6.Value = False OptionButton7.Value = False OptionButton8.Value = False OptionButton9.Value = False OptionButton10.Value = False OptionButton11.Value = False choix = 0 lancement = 1 mode = "" End If End Sub Private Sub erreur() mot_clef = mot Msg1 = "Vous n'avez pas choisi de type de recherche!" Msg2 = "Vous n'avez saisi aucune recherche!" Style = vbOKOnly + vbExclamation Title = "Erreur!" valid = 0 If (choix = 0) Then Box = MsgBox(Msg1, Style, Title) ElseIf mot = "" And mode <> "modif" Then Box = MsgBox(Msg2, Style, Title) Else valid = 1 End If mot = "" End Sub Function select_a_folder(message, directory) ok = False Const WINDOW_HANDLE = 0 Const NO_OPTIONS = 0 Set objShell = CreateObject("Shell.Application") Set objFolder = objShell.BrowseForFolder _ (WINDOW_HANDLE, message, NO_OPTIONS, directory) On Error Resume Next Set objFolderItem = objFolder.Self If Err <> 0 Then select_a_folder = "ANNUL" Else select_a_folder = objFolderItem.Path ok = True End If On Error GoTo 0 End Function Private Sub OptionButton1_Click() mode = "colonne" choix = 1 End Sub Private Sub OptionButton2_Click() mode = "colonne" choix = 3 End Sub Private Sub OptionButton3_Click() mode = "colonne" choix = 4 End Sub Private Sub OptionButton4_Click() mode = "colonne" choix = 4 End Sub Private Sub OptionButton5_Click() mode = "colonne" choix = 5 End Sub Private Sub OptionButton6_Click() mode = "colonne" choix = 6 End Sub Private Sub OptionButton7_Click() mode = "colonne" choix = 8 End Sub Private Sub OptionButton8_Click() mode = "modif" choix = 1 End Sub Private Sub OptionButton9_Click() mode = "partie" choix = 1 End Sub Private Sub OptionButton10_Click() mode = "intervalle" choix = 1 End Sub Private Sub OptionButton11_Click() mode = "cellule" End Sub Private Sub Recherche_Click() erreur If valid = 1 Then If mode = "modif" Then chemin = select_a_folder("Veuillez sélectionner un dossier dans lequel s'effectuera la recherche de toutes les modifications", "c:\Convoyeurs\EXCEL\") Else chemin = select_a_folder("Veuillez sélectionner un dossier dans lequel s'effectuera la recherche de " & mot_clef & "", "c:\Convoyeurs\EXCEL\") End If If ok = True Then Application.Workbooks("recherche.xls").Worksheets("Résultats").Range("A7:M65536").Clear Application.Workbooks("recherche.xls").Worksheets("listing").Cells.Clear lister chercher Application.Workbooks("recherche.xls").Worksheets("Résultats").Activate Application.Workbooks("recherche.xls").Worksheets("Résultats").Range("A" & k & "").Select MsgBox ("" & (k - 7) & " résultat(s) trouvé(s)") End If End If End Sub Function chercher() k = 7 For cellule = 3 To (derniere_colonne + 2) fin = Application.Workbooks("recherche.xls").Worksheets("listing").Cells(65536, cellule).End(xlUp).Row For a = 1 To fin Workbooks.Open Feuil2.Cells(a, cellule).Value fichier = Split(Feuil2.Cells(a, cellule).Value, "\") If mode = "colonne" Then LaDerniere = Application.Workbooks(fichier(4)).Worksheets("Tableau").Cells(65536, choix).End(xlUp).Row For i = 20 To LaDerniere If Application.Workbooks(fichier(4)).Worksheets("Tableau").Cells(i, choix).Value = mot_clef Then Application.Workbooks(fichier(4)).Worksheets("Tableau").Range("A" & i & ":L" & i & "").Copy Application.Workbooks("recherche.xls").Worksheets("Résultats").Activate Application.Workbooks("recherche.xls").Worksheets("Résultats").Range("B" & k & "").Select ActiveSheet.Paste With Worksheets("Résultats") .Hyperlinks.Add .Range("A" & k & ""), Feuil2.Cells(a, cellule).Value End With k = k + 1 End If Next i ElseIf mode = "modif" Then LaDerniere = Application.Workbooks(fichier(4)).Worksheets("Tableau").Cells(65536, choix).End(xlUp).Row For i = 20 To LaDerniere If Application.Workbooks(fichier(4)).Worksheets("Tableau").Cells(i, choix).Value <> "" Then Application.Workbooks(fichier(4)).Worksheets("Tableau").Range("A" & i & ":L" & i & "").Copy Application.Workbooks("recherche.xls").Worksheets("Résultats").Activate Application.Workbooks("recherche.xls").Worksheets("Résultats").Range("B" & k & "").Select ActiveSheet.Paste With Worksheets("Résultats") .Hyperlinks.Add .Range("A" & k & ""), Feuil2.Cells(a, cellule).Value End With k = k + 1 End If Next i ElseIf mode = "cellule" Then If Application.Workbooks(fichier(4)).Worksheets("Tableau").Range("C5").Value = mot_clef Then LaDerniere = Application.Workbooks(fichier(4)).Worksheets("Tableau").Cells(65536, 1).End(xlUp).Row For i = 20 To LaDerniere Application.Workbooks(fichier(4)).Worksheets("Tableau").Range("A" & i & ":L" & i & "").Copy Application.Workbooks("recherche.xls").Worksheets("Résultats").Activate Application.Workbooks("recherche.xls").Worksheets("Résultats").Range("B" & k & "").Select ActiveSheet.Paste With Worksheets("Résultats") .Hyperlinks.Add .Range("A" & k & ""), Feuil2.Cells(a, cellule).Value End With k = k + 1 Next i End If ElseIf mode = "partie" Then LaDerniere = Application.Workbooks(fichier(4)).Worksheets("Tableau").Cells(65536, choix).End(xlUp).Row For i = 20 To LaDerniere If Application.Workbooks(fichier(4)).Worksheets("Tableau").Cells(i, choix).Value <> "" Then Application.Workbooks(fichier(4)).Worksheets("Tableau").Range("A" & i & ":L" & i & "").Copy Application.Workbooks("recherche.xls").Worksheets("Résultats").Activate Application.Workbooks("recherche.xls").Worksheets("Résultats").Range("B" & k & "").Select ActiveSheet.Paste With Worksheets("Résultats") .Hyperlinks.Add .Range("A" & k & ""), Feuil2.Cells(a, cellule).Value End With k = k + 1 End If Next i ElseIf mode = "intervalle" Then LaDerniere = Application.Workbooks(fichier(4)).Worksheets("Tableau").Cells(65536, choix).End(xlUp).Row For i = 20 To LaDerniere If Application.Workbooks(fichier(4)).Worksheets("Tableau").Cells(i, choix).Value <> "" Then Application.Workbooks(fichier(4)).Worksheets("Tableau").Range("A" & i & ":L" & i & "").Copy Application.Workbooks("recherche.xls").Worksheets("Résultats").Activate Application.Workbooks("recherche.xls").Worksheets("Résultats").Range("B" & k & "").Select ActiveSheet.Paste With Worksheets("Résultats") .Hyperlinks.Add .Range("A" & k & ""), Feuil2.Cells(a, cellule).Value End With k = k + 1 End If Next i End If Application.Workbooks(fichier(4)).Activate ActiveWorkbook.Close Next a Next cellule mot_clef = "" End Function Function lister() TousLesDossiers "" & chemin & "", 0 TousLesFichiers End Function Function TousLesDossiers(LeDossier$, Idx As Long) Set fso = CreateObject("Scripting.FileSystemObject") Set Dossier = fso.GetFolder(LeDossier) 'examen du dossier courant For Each Flder In Dossier.subfolders Idx = Idx + 1 Feuil2.Range("a" & Idx & "").Value = Flder.Path Next Set fso = Nothing End Function 'fs Function TousLesFichiers() Set fs = Application.FileSearch If Feuil2.Range("A1").Value = "" Then Feuil2.Range("A1").Value = Dossier derniere_colonne = 1 Else derniere_colonne = 4 End If For F = 1 To derniere_colonne With fs .LookIn = "" & Feuil2.Range("A" & F & "").Value & "" .Filename = "*" .Execute For i = 1 To .FoundFiles.Count If F = 1 Then cellul = "C" ElseIf F = 2 Then cellul = "D" ElseIf F = 3 Then cellul = "E" ElseIf F = 4 Then cellul = "F" End If Feuil2.Range("" & cellul & "" & i & "").Value = .FoundFiles(i) Next i If .FoundFiles.Count = 0 Then MsgBox "Aucun fichier n'a été trouvé." End If End With Next F End Function
Dites moi ce qui différe l'un de l'autre mise à part les conditions if mode ="..." parce que là je vois pas ce qui fait merder mon programme!!!
random
Messages postés
1612
Date d'inscription
vendredi 26 novembre 2004
Statut
Membre
Dernière intervention
30 mars 2006
155
4 août 2005 à 14:04
4 août 2005 à 14:04
d'abord déclare clef utilisateur en variant
ensuite tu pourrais dans l'inspecteur d'objet examiner filesearch
c'est jusue une idée comme ca
ensuite tu pourrais dans l'inspecteur d'objet examiner filesearch
c'est jusue une idée comme ca
Utilisateur anonyme
>
random
Messages postés
1612
Date d'inscription
vendredi 26 novembre 2004
Statut
Membre
Dernière intervention
30 mars 2006
4 août 2005 à 14:10
4 août 2005 à 14:10
Dim mot_clef As Variant
çà n'a rien changé...
C'est quoi filesearch?
Pourquoi le premier programme fonctionne sans problème mais pas le deuxième?
Y'a rien de changer par rapport à la variable mot_clef!!!
Je deviens fou!!!
Utilisateur anonyme
4 août 2005 à 14:57
4 août 2005 à 14:57
Salut KdTcA,
Voici quelques observations (1er prog), celles-ci ne font pas force de loi,
c'est tout simplement ma façon de travailler. Cela pourra peut-être
te mettre sur une piste. Ces observations sont tirés de la syntaxe
du code et non sur la structure. Je me pencherai plus sur la structure
ultérieurement si besoin est...
Je répète, prend ces observations avec un grain de sel !!!
Je me pencherai sur le deuxième prog ultérieurement.
Bon courage.
Lupin
Voici quelques observations (1er prog), celles-ci ne font pas force de loi,
c'est tout simplement ma façon de travailler. Cela pourra peut-être
te mettre sur une piste. Ces observations sont tirés de la syntaxe
du code et non sur la structure. Je me pencherai plus sur la structure
ultérieurement si besoin est...
Je répète, prend ces observations avec un grain de sel !!!
'Beaucoup de variable globale pour un si petit 'programme, certaines devraient être traduite 'en local et passer en paramètres. Dim Chemin, Mot_Clef As String Dim Valid, Lancement, Fin, K, Choix As Integer Dim Ok As Boolean Dim Cellule As Integer Dim Cellul As String 'Lupin -> Déclaration contreversé 'Les variables utilisées avec des objets de scripting 'devrait toujours être déclaré en variant Dim Fso, Dossier, Flder As Variant 'Lupin -> Les variables devrait toujours être typé 'même si implicite, meilleur compréhension du système Dim Nb, Derniere_Colonne As Variant Dim Msg1, Msg2, Style, Title, Box As Variant Dim Fichier As Variant ' Sub Main() If Lancement = 0 Then OptionButton1.Value = False OptionButton2.Value = False OptionButton3.Value = False OptionButton4.Value = False OptionButton5.Value = False OptionButton6.Value = False OptionButton7.Value = False Choix = 0 Lancement = 1 End If End Sub ' Private Sub Erreur() Mot_Clef = Mot Msg1 = "Vous n'avez pas choisi de type de recherche!" Msg2 = "Vous n'avez saisi aucune recherche!" Style = vbOKOnly + vbExclamation Title = "Erreur!" Valid = 0 If (Choix = 0) Then Box = MsgBox(Msg1, Style, Title) Else If Mot = "" Then Box = MsgBox(Msg2, Style, Title) Else Valid = 1 End If End If Mot = "" End Sub ' Function Select_A_Folder(message, directory) Ok = False Const WINDOW_HANDLE = 0 Const NO_OPTIONS = 0 Set objShell = CreateObject("Shell.Application") Set objFolder = objShell.BrowseForFolder _ (WINDOW_HANDLE, message, NO_OPTIONS, directory) On Error Resume Next Set objFolderItem = objFolder.Self If Err <> 0 Then Select_A_Folder = "ANNUL" Else Select_A_Folder = objFolderItem.Path Ok = True End If 'Lupin -> Je ne comprends pas la necessité de cette ligne On Error GoTo 0 End Function ' Private Sub OptionButton1_Click() Choix = 1 End Sub ' Private Sub OptionButton2_Click() Choix = 3 End Sub ' Private Sub OptionButton3_Click() Choix = 4 End Sub ' Private Sub OptionButton4_Click() Choix = 4 End Sub ' Private Sub OptionButton5_Click() Choix = 5 End Sub ' Private Sub OptionButton6_Click() Choix = 6 End Sub ' Private Sub OptionButton7_Click() Choix = 8 End Sub ' Private Sub Recherche_Click() Erreur If Valid = 1 Then Chemin = Select_A_Folder("Veuillez sélectionner un dossier dans lequel s'effectuera la recherche par " & Choix & " de " & Mot & "", "c:\Convoyeurs\EXCEL\") If (Ok) Then Application.Workbooks("recherche.xls").Worksheets("Résultats").Range("A7:L65536").Clear Application.Workbooks("recherche.xls").Worksheets("listing").Cells.Clear Lister Chercher End If End If Application.Workbooks("recherche.xls").Worksheets("Résultats").Activate Application.Workbooks("recherche.xls").Worksheets("Résultats").Range("A" & K & "").Select MsgBox ("" & ((K - 7) / 4) & " résultat(s) trouvé(s)") End Sub Function Chercher() K = 7 For Cellule = 3 To (Derniere_Colonne + 2) Fin = Application.Workbooks("recherche.xls").Worksheets("listing").Cells(65536, Cellule).End(xlUp).Row 'Lupin -> Où est définit la variable [a]??? For a = 1 To Fin Workbooks.Open Feuil2.Cells(a, Cellule).Value Fichier = Split(Feuil2.Cells(a, Cellule).Value, "\") LaDerniere = Application.Workbooks(Fichier(4)).Worksheets("Tableau").Cells(65536, Choix).End(xlUp).Row 'Lupin -> Où est définit la variable [i]??? For i = 20 To LaDerniere If Application.Workbooks(Fichier(4)).Worksheets("Tableau").Cells(i, Choix).Value = Mot_Clef Then Application.Workbooks(Fichier(4)).Worksheets("Tableau").Range("A" & i & ":L" & (i + 3) & "").Copy Application.Workbooks("recherche.xls").Worksheets("Résultats").Activate Application.Workbooks("recherche.xls").Worksheets("Résultats").Range("A" & K & "").Select ActiveSheet.Paste With Worksheets("Résultats") .Hyperlinks.Add .Range("A" & K & ""), Feuil2.Cells(a, Cellule).Value End With K = K + 4 End If Next i Application.Workbooks(Fichier(4)).Activate ActiveWorkbook.Close Next a Next Cellule Mot_Clef = "" End Function ' Function Lister() TousLesDossiers "" & Chemin & "", 0 TousLesFichiers End Function ' Function TousLesDossiers(LeDossier$, Idx As Long) Set Fso = CreateObject("Scripting.FileSystemObject") Set Dossier = Fso.GetFolder(LeDossier) 'examen du dossier courant For Each Flder In Dossier.subfolders Idx = Idx + 1 Feuil2.Range("a" & Idx & "").Value = Flder.Path Next Set Fso = Nothing End Function ' Function TousLesFichiers() 'Lupin -> Où est définit la variable [fs]??? Set fs = Application.FileSearch If Feuil2.Range("A1").Value = "" Then Feuil2.Range("A1").Value = Dossier Derniere_Colonne = 1 Else Derniere_Colonne = 4 End If 'Lupin -> Où est définit la variable [F]??? For F = 1 To Derniere_Colonne With fs .LookIn = "" & Feuil2.Range("A" & F & "").Value & "" .Filename = "*" .Execute 'Lupin -> Où est définit la variable [i]??? For i = 1 To .FoundFiles.Count If F = 1 Then Cellul = "C" Else If F = 2 Then Cellul = "D" Else If F = 3 Then Cellul = "E" Else If F = 4 Then Cellul = "F" End If End If End If End If Feuil2.Range("" & Cellul & "" & i & "").Value = .FoundFiles(i) Next i If .FoundFiles.Count = 0 Then MsgBox "Aucun fichier n'a été trouvé." End If End With Next F End Function
Je me pencherai sur le deuxième prog ultérieurement.
Bon courage.
Lupin
Merci!
Mais en fait le 1er programme me sert plus à rien vu que c'est le deuxième qui doit marcher pour être mis en place en maitenance d'un secteur de l'usine... :S
Mais en fait le 1er programme me sert plus à rien vu que c'est le deuxième qui doit marcher pour être mis en place en maitenance d'un secteur de l'usine... :S
'Lupin -> Où est définit la variable [F]???
Réponse pour à chaque fois que tu as mis çà:
çà sert à rien de les définir ces variables...
'Lupin -> Je ne comprends pas la necessité de cette ligne On Error GoTo 0
J'ai trouvé çà tout fait et je crois que c'est pour empêcher de venir dans le programme en cas d'erreur...
Utilisateur anonyme
4 août 2005 à 15:21
4 août 2005 à 15:21
re:
À mon avis :
Une variable non déféni pourra entrainer une erreur de type [1004]
Le genre qui te pose problème actuellement !!!
Dans le cas de [On Error GoTo 0] n'a aucun impact à mon avis
puisque c'est la ligne [On Error Resume Next
] qui est interprèté en premier.
Bon, je vais jeter un oeil sur le deuxième ... !!! ???
Lupin
...çà sert à rien de les définir ces variables...
À mon avis :
Une variable non déféni pourra entrainer une erreur de type [1004]
Le genre qui te pose problème actuellement !!!
Dans le cas de [On Error GoTo 0] n'a aucun impact à mon avis
puisque c'est la ligne [On Error Resume Next
] qui est interprèté en premier.
Bon, je vais jeter un oeil sur le deuxième ... !!! ???
Lupin
Je n'ai aucun message d'erreur!
Au niveau de ce type de ligne :
> marche pas
> marche pas
> marche
Au niveau de ce type de ligne :
If Application.Workbooks(fichier(4)).Worksheets("Tableau").Cells(i, choix).Value = mot_clef Then
> marche pas
If Application.Workbooks(fichier(4)).Worksheets("Tableau").Cells(i, choix).Value = "" & mot_clef & ""Then
> marche pas
If Application.Workbooks(fichier(4)).Worksheets("Tableau").Cells(i, choix).Value = "31/12/2005" Then
> marche
Utilisateur anonyme
4 août 2005 à 16:41
4 août 2005 à 16:41
Problème non résolu (merci de poster un complément d'information pour faire remonter le fil de discussion)
voilà c'est fait... lol
voilà c'est fait... lol
Utilisateur anonyme
4 août 2005 à 16:41
4 août 2005 à 16:41
re:
If Application.Workbooks(fichier(4)).Worksheets("Tableau").Cells(i, choix).Value = format(mot_clef, "dd/mm/yyyy") Then
ou
If Application.Workbooks(fichier(4)).Worksheets("Tableau").Cells(i, choix).Value = format(mot_clef, "jj/mm/aaaa") Then
Lupin
If Application.Workbooks(fichier(4)).Worksheets("Tableau").Cells(i, choix).Value = format(mot_clef, "dd/mm/yyyy") Then
ou
If Application.Workbooks(fichier(4)).Worksheets("Tableau").Cells(i, choix).Value = format(mot_clef, "jj/mm/aaaa") Then
Lupin
random
Messages postés
1612
Date d'inscription
vendredi 26 novembre 2004
Statut
Membre
Dernière intervention
30 mars 2006
155
4 août 2005 à 17:05
4 août 2005 à 17:05
If Application.Workbooks(fichier(4)).Worksheets("Tableau").Cells(i, choix).Value = format(mot_clef, "dd/mm/yyyy") Then
msgox("je suis dans la boucle")
si on n'a pas le message
on n'entre pas dans lacondition
sinon le pb vien d'ailleurs
msgox("je suis dans la boucle")
si on n'a pas le message
on n'entre pas dans lacondition
sinon le pb vien d'ailleurs
Utilisateur anonyme
4 août 2005 à 17:29
4 août 2005 à 17:29
suite:
si :
If Application.Workbooks(fichier(4)).Worksheets("Tableau").Cells(i, choix).Value = FormatDateTime(mot_clef) Then
ou
Dim DateCible As Date
DateCible = FormatDateTime(Workbooks(fichier(4)).Worksheets("Tableau").Cells(i, choix).Value)
if ( DateCible = FormatDateTime(mot_clef) Then
Lupin
si :
If Application.Workbooks(fichier(4)).Worksheets("Tableau").Cells(i, choix).Value = FormatDateTime(mot_clef) Then
ou
Dim DateCible As Date
DateCible = FormatDateTime(Workbooks(fichier(4)).Worksheets("Tableau").Cells(i, choix).Value)
if ( DateCible = FormatDateTime(mot_clef) Then
Lupin
Utilisateur anonyme
5 août 2005 à 09:59
5 août 2005 à 09:59
Bon ben c'est bien ce qu'il me semblait...
J'avais déjà testé les autres modes de recherche et çà veut pas!!!
J'avais déjà testé les autres modes de recherche et çà veut pas!!!