Sub synthese()
Set onglet1 = Sheets("Vm")
Set onglet2 = Sheets("VC")
Sheets("recap").[A2:D10000].ClearContents
Range(onglet1.[A2], onglet1.[A65000].End(xlUp).Offset(0, 2)).Copy Sheets("recap").[A2]
For Each c In Range(onglet2.[A2], onglet2.[A65000].End(xlUp))
p = Application.Match(c, [A:A], 0)
If IsError(p) Then
[A65000].End(xlUp).Offset(1, 0) = c
[A65000].End(xlUp).Offset(0, 1) = c.Offset(0, 1)
[A65000].End(xlUp).Offset(0, 3) = c.Offset(0, 2)
Else
[A1].Offset(p - 1, 3) = c.Offset(0, 2)
End If
Next c
End Sub
Sub synthese()
Set onglet1 = Sheets("VM")
Set onglet2 = Sheets("VC")
Sheets("RECAP").[A2:D10000].ClearContents
Range(onglet1.[A2], onglet1.[A65000].End(xlUp).Offset(0, 2)).Copy Sheets("RECAP").[A2]
For Each c In Range(onglet2.[A2], onglet2.[A65000].End(xlUp))
p = Application.Match(c, [A:A], 0)
If IsError(p) Then
[A65000].End(xlUp).Offset(1, 0) = c
[A65000].End(xlUp).Offset(0, 1) = c.Offset(0, 1)
[A65000].End(xlUp).Offset(0, 3) = c.Offset(0, 2)
Else
[A1].Offset(p - 1, 3) = c.Offset(0, 2)
End If
Next c
End Sub
Sub synthese()
Set onglet1 = Sheets("Vm")
Set onglet2 = Sheets("VC")
Sheets("recap").[A2:D10000].ClearContents
Range(onglet1.[A2], onglet1.[A65000].End(xlUp).Offset(0, 2)).Copy Sheets("recap").[A2]
For Each c In Range(onglet2.[A2], onglet2.[A65000].End(xlUp))
p = Application.Match(c, [A:A], 0)
If IsError(p) Then
[A65000].End(xlUp).Offset(1, 0) = c
[A65000].End(xlUp).Offset(0, 1) = c.Offset(0, 1)
[A65000].End(xlUp).Offset(0, 3) = c.Offset(0, 2)
Else
[A1].Offset(p - 1, 3) = c.Offset(0, 2)
End If
Next c
End Sub
...On traite cinq onglets ou deux ? Le titre du fil dit 5, la macro dit 2 ...
Option Explicit
Sub Onglets_fusionner()
Dim o As Worksheet
Application.ScreenUpdating = False
Sheets("RECAP").Range(Range("a2"), Range("j2").End(xlDown)).Clear
For Each o In Worksheets
If o.Name <> "RECAP" Then
With o
.Range(.Range("a3"), .Range("j3").End(xlDown)).Copy Destination:=Sheets("RECAP").Range("a65536").End(xlUp)(2)
End With
End If
Next
Application.ScreenUpdating = True
End Sub
Sub a()
Dim ws As Worksheet, dl&, dlig&
For Each ws In Worksheets
If Len(ws.Name) <= 3 Then
dl = ws.Cells(Rows.Count, 1).End(xlUp).Row
dlig = Sheets("RECAP").Cells(Rows.Count, 1).End(xlUp).Row + 1
ws.Cells(3, 1).Resize(dl, 10).Copy Sheets("RECAP").Cells(dlig, 1)
End If
Next ws
End Sub
...00:
Avec le xlDown si il y un trou* dans le tableau, il y aura des surprises
(*: des lignes vides , ce qui crée de zones non contiguës)
Sub Onglets_fusionnerII()
Dim o As Worksheet
Application.ScreenUpdating = False
Sheets("RECAP").Rows("3:65536").Clear
For Each o In Worksheets
If o.Name <> "RECAP" Then
With o
.Range(.Range("a3"), .Range("j3").End(xlDown)).Copy Destination:=Sheets("RECAP").Range("a65536").End(xlUp)(2)
End With
End If
Next
Application.ScreenUpdating = True
End Sub
... j'ai erreur de syntaxe : Dim o As Worksheet, le o correspond à quoi ?..
Option Explicit
Dim o As Worksheet