Jul74ien74
XLDnaute Nouveau
Bonjour,
je voudrais savoir si ce code peut etre simplifié dans le sens ou je voudrais mettre : si dans chaque ligne de la colonne "D" les mots ....... sont present alors fais ceci sinon passe a la ligne suivante.
Sub AfficherInfoFichier()
For Lig = 8 To 10
If Cells(Lig, 4).Value = "1_01_Room-Layout\" Then
FichierATester = [M2] + Cells(Lig, 4) + Cells(Lig, 8)
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFile(FichierATester)
Cells(Lig, 10).Value = f.DateLastModified
End If
Next Lig
For Lig = 13 To 21
If Cells(Lig, 4).Value = "1_02_Desk-Layout\" Then
FichierATester = [M2] + Cells(Lig, 4) + Cells(Lig, 8)
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFile(FichierATester)
Cells(Lig, 10).Value = f.DateLastModified
End If
Next Lig
For Lig = 24 To 30
If Cells(Lig, 4).Value = "1_03_Rack-Layout\" Then
FichierATester = [M2] + Cells(Lig, 4) + Cells(Lig, 8)
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFile(FichierATester)
Cells(Lig, 10).Value = f.DateLastModified
End If
Next Lig
For Lig = 33 To 40
If Cells(Lig, 4).Value = "1_04_Blockdiagram\" Then
FichierATester = [M2] + Cells(Lig, 4) + Cells(Lig, 8)
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFile(FichierATester)
Cells(Lig, 10).Value = f.DateLastModified
End If
Next Lig
For Lig = 45 To 63
If Cells(Lig, 4).Value = "2_01_Video\" Then
FichierATester = [M2] + Cells(Lig, 4) + Cells(Lig, 8)
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFile(FichierATester)
Cells(Lig, 10).Value = f.DateLastModified
End If
Next Lig
For Lig = 66 To 75
If Cells(Lig, 4).Value = "2_02_Audio\" Then
FichierATester = [M2] + Cells(Lig, 4) + Cells(Lig, 8)
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFile(FichierATester)
Cells(Lig, 10).Value = f.DateLastModified
End If
Next Lig
For Lig = 78 To 80
If Cells(Lig, 4).Value = "2_03_Pilotage\" Then
FichierATester = [M2] + Cells(Lig, 4) + Cells(Lig, 8)
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFile(FichierATester)
Cells(Lig, 10).Value = f.DateLastModified
End If
Next Lig
For Lig = 85 To 120
If Cells(Lig, 4).Value = "3_01_Patchfields\" Then
FichierATester = [M2] + Cells(Lig, 4) + Cells(Lig, 8)
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFile(FichierATester)
Cells(Lig, 10).Value = f.DateLastModified
End If
Next Lig
For Lig = 127 To 161
If Cells(Lig, 4).Value = "4_01_Constructions\" Then
FichierATester = [M2] + Cells(Lig, 4) + Cells(Lig, 8)
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFile(FichierATester)
Cells(Lig, 10).Value = f.DateLastModified
End If
Next Lig
End Sub
je voudrais savoir si ce code peut etre simplifié dans le sens ou je voudrais mettre : si dans chaque ligne de la colonne "D" les mots ....... sont present alors fais ceci sinon passe a la ligne suivante.
Sub AfficherInfoFichier()
For Lig = 8 To 10
If Cells(Lig, 4).Value = "1_01_Room-Layout\" Then
FichierATester = [M2] + Cells(Lig, 4) + Cells(Lig, 8)
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFile(FichierATester)
Cells(Lig, 10).Value = f.DateLastModified
End If
Next Lig
For Lig = 13 To 21
If Cells(Lig, 4).Value = "1_02_Desk-Layout\" Then
FichierATester = [M2] + Cells(Lig, 4) + Cells(Lig, 8)
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFile(FichierATester)
Cells(Lig, 10).Value = f.DateLastModified
End If
Next Lig
For Lig = 24 To 30
If Cells(Lig, 4).Value = "1_03_Rack-Layout\" Then
FichierATester = [M2] + Cells(Lig, 4) + Cells(Lig, 8)
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFile(FichierATester)
Cells(Lig, 10).Value = f.DateLastModified
End If
Next Lig
For Lig = 33 To 40
If Cells(Lig, 4).Value = "1_04_Blockdiagram\" Then
FichierATester = [M2] + Cells(Lig, 4) + Cells(Lig, 8)
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFile(FichierATester)
Cells(Lig, 10).Value = f.DateLastModified
End If
Next Lig
For Lig = 45 To 63
If Cells(Lig, 4).Value = "2_01_Video\" Then
FichierATester = [M2] + Cells(Lig, 4) + Cells(Lig, 8)
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFile(FichierATester)
Cells(Lig, 10).Value = f.DateLastModified
End If
Next Lig
For Lig = 66 To 75
If Cells(Lig, 4).Value = "2_02_Audio\" Then
FichierATester = [M2] + Cells(Lig, 4) + Cells(Lig, 8)
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFile(FichierATester)
Cells(Lig, 10).Value = f.DateLastModified
End If
Next Lig
For Lig = 78 To 80
If Cells(Lig, 4).Value = "2_03_Pilotage\" Then
FichierATester = [M2] + Cells(Lig, 4) + Cells(Lig, 8)
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFile(FichierATester)
Cells(Lig, 10).Value = f.DateLastModified
End If
Next Lig
For Lig = 85 To 120
If Cells(Lig, 4).Value = "3_01_Patchfields\" Then
FichierATester = [M2] + Cells(Lig, 4) + Cells(Lig, 8)
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFile(FichierATester)
Cells(Lig, 10).Value = f.DateLastModified
End If
Next Lig
For Lig = 127 To 161
If Cells(Lig, 4).Value = "4_01_Constructions\" Then
FichierATester = [M2] + Cells(Lig, 4) + Cells(Lig, 8)
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFile(FichierATester)
Cells(Lig, 10).Value = f.DateLastModified
End If
Next Lig
End Sub