Option Explicit
Sub test()
Dim ws As Worksheet, c As Range, x As Range
For Each ws In Worksheets
If ws.Name Like "BAL*" Then
With Worksheets("PLAN COMPTABLE")
ws.Range("A1:B" & ws.Cells.Find("*", ws.Cells(.Rows.Count, ws.Columns.Count), xlValues, , 1, 2, 0).Row).Copy _
Destination:=.Cells(.Cells.Find("*", .Cells(.Rows.Count, .Columns.Count), xlValues, , 1, 2, 0).Row, 1)(2)
End With
End If
Next ws
With Worksheets("PLAN COMPTABLE")
With .Range("A1:B" & .Cells.Find("*", .Cells(.Rows.Count, .Columns.Count), xlValues, , 1, 2, 0).Row)
.RemoveDuplicates Columns:=Array(1, 2), Header:=xlYes
.Sort Worksheets("PLAN COMPTABLE").Range("A1"), xlAscending, Header:=xlYes
End With
End With
For Each ws In Worksheets
If ws.Name Like "BAL*" Then
With ws
On Error Resume Next
For Each c In .Range("A1:A" & .Cells.Find("*", .Cells(.Rows.Count, .Columns.Count), xlValues, , 1, 2, 0).Row).SpecialCells(xlCellTypeBlanks)
Set x = Worksheets("PLAN COMPTABLE").Columns(2).Find(c.Offset(0, 1), , xlValues, xlWhole, , , False)
If Not x Is Nothing Then c = x.Offset(0, -1)
Next c
For Each c In .Range("B1:B" & .Cells.Find("*", .Cells(.Rows.Count, .Columns.Count), xlValues, , 1, 2, 0).Row).SpecialCells(xlCellTypeBlanks)
Set x = Worksheets("PLAN COMPTABLE").Columns(1).Find(c.Offset(0, -1), , xlValues, xlWhole, , , False)
If Not x Is Nothing Then c = x.Offset(0, 1)
Next c
.Range("C1:F" & .Cells.Find("*", .Cells(.Rows.Count, .Columns.Count), xlValues, , 1, 2, 0).Row).SpecialCells(xlCellTypeBlanks).Value = 0
On Error GoTo 0
End With
End If
Next ws
End Sub