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
| Sub MacroFINALEssai()
'
Dim numLigneVideUn As Integer
Dim ws As Worksheet
Sheets("BD").Select
Cells.Select
Selection.ClearContents
Range("A1").Select
ActiveCell.FormulaR1C1 = "Nom Matériel"
Range("B1").Select
Sheets("Service Administration").Select
Range("A600:A612").Select
Selection.Copy
Sheets("BD").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=True
Application.CutCopyMode = False
For Each ws In ThisWorkbook.Worksheets
If ws.Name Like "Service*" Then
Sheets(ws.Name).Select
Range("B1", Range("B1").End(xlToRight)).Select
Selection.Copy
Sheets("BD").Activate
'on trouve la dernière ligne vide de la colonne A et on enregistre le numéro de la ligne dans la variable numLigneVide
numLigneVide = Range("A65536").End(xlUp).Row + 1
ActiveSheet.Cells(numLigneVide, 1).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=True
Application.CutCopyMode = False
Sheets(ws.Name).Select
Range("B600:B612", Range("B600:B612").End(xlToRight)).Select
Selection.Copy
Sheets("BD").Activate
'on trouve la dernière ligne vide de la colonne B et on enregistre le numéro de la ligne dans la variable numLigneVide
numLigneVide = Range("B65536").End(xlUp).Row + 1
ActiveSheet.Cells(numLigneVide, 2).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=True
Application.CutCopyMode = False
Sheets(ws.Name).Select
Range("B3").Select
End If
Next
Sheets("Sommaire").Select
End Sub |
Partager