1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
| Sub CopierDonnees()
Dim Entree As Workbook, Sortie As Workbook
Nomfichierentree = Application.GetOpenFilename("Fichier Excel (*.xls), *.xsl")
' On verifie que l'on a selectionné un nom de classeur
If Nomfichierentree <> False Then
' On ouvre le classeur
Set Entree = Workbooks.Open(Nomfichierentree)
End If
NomFichierSortie = Application.GetOpenFilename("Fichier Excel (*.xls), *.xsl")
If NomFichierSortie <> False Then
Set Sortie = Workbooks.Open(NomFichierSortie)
End If
'Worksheets("Report").Copy After:=Sheets(Worksheets.Count)
'Columns("C:C").Delete Shift:=xlToLeft
Sheets.Add After:=Sheets(Sheets.Count)
ActiveSheet.Name = "chantier"
Worksheets("Report").Range("1:1,1324:1475").Copy Worksheets("chantier").Range("A1")
'jusqu'ici tout va bien , mais ensuite a partir de la il ne fait plus rien
Dim i As Long
Dim j As Long
Dim n As Variant
For j = 8 To 19
n = 19 - j + 8
For i = 2 To n
Cells(i, j).Value = Cells(i, j).Value + Cells(i + 4 * 19, j).Value
'Cells(2 * i, j).Value = Cells(2 * i, j).Value + Cells(2 * i + 4 * 19, j).Value
'Cells(3 * i, j).Value = Cells(3 * i, j).Value + Cells(3 * i + 4 * 19, j).Value
'Cells(4 * i, j).Value = Cells(4 * i, j).Value + Cells(3 * i + 4 * 19, j).Value
Next i
Next j
Range("A1400:Y1475").Select
Selection.EntireRow.Delete
' Sheets("Report (2)").Select
' ActiveWindow.SelectedSheets.Delete |
Partager