Re : Création d'une base par copier coller en macro vba avec une sélection multiple
bonjour ou rebonjour
voila mon projet a bien avancer et fonctionne bien sur mes classeur comprenant peu de feuille mais des que le nombre de feuille augmente ca plante une petite aide svp
voila ce que cela affiche avec les variables locales
et voila la macro complete
Sub majtreso()
'
' majtreso Macro
'
Application.ScreenUpdating = True
'
Cells.Select
Sheets("base").Select
Cells.Select
Selection.Delete Shift:=xlUp
Cells.Select
Sheets("IL1-1").Select
Rows("7:7").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("base").Select
Rows("1:1").Select
ActiveSheet.Paste
Cells.Select
Dim nombre_feuille As Integer
Dim feuille As Integer
Dim ligne As Integer
Dim nombre_ligne As Integer
Dim ligne_destination As Integer
Dim valeur_cherche As String
ligne_destination = 2
nombre_feuille = Sheets.Count - 1
For feuille = 1 To nombre_feuille
'Worksheets(feuille + 1).Select
nombre_ligne = Worksheets(feuille + 1).Range("a65535").End(xlUp).Row
For ligne = 1 To nombre_ligne
Worksheets(feuille + 1).Select
valeur_cherche = Worksheets(feuille + 1).Cells(ligne, 1).Value
If valeur_cherche = "1" Or valeur_cherche = "2" Then
Worksheets(feuille + 1).Rows(ligne).Select
Selection.Copy
Sheets("base").Select
Rows(ligne_destination).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
ligne_destination = ligne_destination + 1
End If
Next ligne
Next feuille
Application.ScreenUpdating = True
Sheets("tréso").Select
Range("A7").Select
ActiveWorkbook.RefreshAll
End Sub