Re : Code qui fonctionne sous excel97 et pas sous 2003
Bonjour Pierrejean
Manque de précision, désolé.
Voici le code dans sa totalité:
Sheets("OF Prioritaires").Select
Rows("2:300").Select
Selection.ClearContents
Cells.Select
Selection.Font.Bold = False
Selection.Font.Size = 12
Selection.Font.ColorIndex = 0
Selection.Interior.ColorIndex = xlNone
Selection.VerticalAlignment = xlCenter
Rows(1).Font.Bold = True
Range("A2").Select
Application.ScreenUpdating = False
lin = 2
i = 4
Workbooks.OpenText FileName:="T:\baan\stat.txt", Origin:=xlWindows, _
StartRow:=1, DataType:=xlDelimited, TextQualifier:=xlDoubleQuote, _
ConsecutiveDelimiter:=False, Tab:=False, Semicolon:=True, Comma:=False _
, Space:=False, Other:=False, FieldInfo:=Array(Array(1, 2))
'While Left(Cells(i, 1), 1) < "5" And Cells(i, 1) <> "" 'Or Left(Cells(i, 1), 1) = "4"
'Test toutes les céllule différente de rien
While Cells(i, 1) <> ""
'Test les projets commençants par "1"-"C"-"2"-"3"
If Left(Cells(i, 1), 1) = "1" Or Left(Cells(i, 1), 1) = "C" Or Left(Cells(i, 1), 1) = "2" Or Left(Cells(i, 1), 1) = "3" Then
Windows("stat.txt").Activate
a = Cells(i, 24)
b = Cells(i, 25)
c = Cells(i, 26)
'd = Cells(i, 27)
e = Cells(i, 31) + Cells(i, 59)
f = Cells(i, 32) + Cells(i, 60)
g = Cells(i, 33) + Cells(i, 61)
k = Cells(i, 85)
l = Cells(i, 86)
m = Cells(i, 87)
n = Cells(i, 88)
O = Cells(i, 89)
p = Cells(i, 92)
q = Cells(i, 93)
pp = Cells(i, 94)
qq = Cells(i, 95)
h = a + b + c + e + f + g + k + l + m + n + O
If h > 0 Then
projet = Cells(i, 1)
Windows("Gestion de Prod.xls").Activate
Sheets("OF Prioritaires").Select
Cells(lin, 1) = projet
Cells(lin, 9) = projet
Cells(lin, 2) = a
Cells(lin, 3) = b
Cells(lin, 4) = c
Cells(lin, 5) = k
Cells(lin, 6) = l
Cells(lin, 7) = m
Cells(lin, 8) = n
Cells(lin, 10) = e
Cells(lin, 11) = f
Cells(lin, 12) = g
Cells(lin, 13) = O
Cells(lin, 18) = p / 60 'Bug poste Phi(2003) pas JB(97)
'Cells(lin, 19) = q / 60 'Bug poste Phi(2003) pas JB(97)
Cells(lin, 20) = pp
Cells(lin, 21) = qq
lin = lin + 1
End If
'i = i + 1
Windows("stat.txt").Activate
End If
i = i + 1
Wend
Windows("stat.txt").Activate
Range(Cells(1, 3), Cells(1, 6)).Copy
Windows("Gestion de Prod.xls").Activate
Sheets("charge US").Activate
Cells(28, 2).Select
ActiveSheet.Paste
Windows("stat.txt").Activate
Range(Cells(1, 7), Cells(1, 10)).Copy
Windows("Gestion de Prod.xls").Activate
Sheets("charge US").Activate
Cells(8, 2).Select
ActiveSheet.Paste
Windows("stat.txt").Activate
Range(Cells(1, 11), Cells(1, 14)).Copy
Windows("Gestion de Prod.xls").Activate
Sheets("charge US").Activate
Cells(30, 2).Select
ActiveSheet.Paste
Windows("stat.txt").Activate
Range(Cells(1, 15), Cells(1, 18)).Copy
Windows("Gestion de Prod.xls").Activate
Sheets("charge US").Activate
Cells(10, 2).Select
ActiveSheet.Paste
Application.DisplayAlerts = False
Windows("stat.txt").Activate
ActiveWindow.Close
Application.DisplayAlerts = True
p est une variable qui collecte un chiffre (avec virgule) dans un fichier de notre EREP
et je désir diviser ce chiffre par 60
Merci pour ton attention sur mon sujet.
Désolé, je ne sais pas mettre le code dans une petite fenêtre comme vous le faites.😱
@+