bonjour
j'aurais besoin d'un petit coup de main
j'ai trouver ce code qui marche nickel pour consolider plusieurs onglet
le souci est le suivant : je souhaiterais consolider les onglets de 4 a10 uniquement
je tenter d'applique une for to mes ca bug
merci d'avance pour votre aide😊
Sub TableauFinal()
Dim sh As Worksheet, F As Worksheet
Set sh = Worksheets.Add
On Error Resume Next
Application.DisplayAlerts = False
Sheets("bd").Delete
Application.DisplayAlerts = True
sh.Name = "bd"
For Each F In Worksheets
If F.Name <> sh.Name Then
If WorksheetFunction.CountA(F.UsedRange) <> 0 Then
With F
.Range(.Cells(1, 1), .Cells(DerLig(F), DerCol(F))).Copy _
sh.Cells(DerLig(sh) + 1, 1)
End With
End If
End If
Next
Set sh = Nothing: Set F = Nothing
End Sub
'--------------------------------------
Function DerLig(sh As Worksheet)
On Error Resume Next
DerLig = sh.Cells.Find(What:="*", _
LookIn:=xlFormulas, _
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious).Row
On Error GoTo 0
End Function
'--------------------------------------
Function DerCol(sh As Worksheet)
On Error Resume Next
DerCol = sh.Cells.Find(What:="*", _
LookIn:=xlFormulas, _
SearchOrder:=xlByColumns, _
SearchDirection:=xlPrevious).Column
On Error GoTo 0
End Function