[Excel-VBA] décomposer une feuille
Résolu/Fermé
deus
Messages postés
93
Date d'inscription
mercredi 20 novembre 2002
Statut
Membre
Dernière intervention
24 mai 2007
-
13 nov. 2006 à 15:30
deus Messages postés 93 Date d'inscription mercredi 20 novembre 2002 Statut Membre Dernière intervention 24 mai 2007 - 17 nov. 2006 à 11:04
deus Messages postés 93 Date d'inscription mercredi 20 novembre 2002 Statut Membre Dernière intervention 24 mai 2007 - 17 nov. 2006 à 11:04
A voir également:
- [Excel-VBA] décomposer une feuille
- Feuille de pointage excel - Télécharger - Tableur
- Liste déroulante excel - Guide
- Déplacer une colonne excel - Guide
- Calculer une moyenne sur excel - Guide
- Word et excel gratuit - Guide
1 réponse
deus
Messages postés
93
Date d'inscription
mercredi 20 novembre 2002
Statut
Membre
Dernière intervention
24 mai 2007
91
17 nov. 2006 à 11:04
17 nov. 2006 à 11:04
Salut,
j'ai résolu mon problème
Pour ceux que ca interessent voici la macro que j'utilise
Sub SplitSheets()
'
' Macro2 Macro
' Macro recorded 17/11/2006 by f4y840
'
'
Dim strBranch As String 'branchcode
Dim nBranch As Integer 'nbr of branch
nBranch = Sheets("Branch").Cells.Find("*", Range("A1"), , , xlByRows, xlPrevious).Row - 1
For i = 2 To nBranch + 1
strBranch = Sheets("Branch").Cells(i, 1)
If strBranch <> "" Then
Sheets("Data").Select
Range("A1:K1").Select
Selection.AutoFilter
Selection.AutoFilter Field:=1, Criteria1:=strBranch
Range("A1").Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Sheets("Empty").Select
Sheets.Add
'ActiveSheets.Select
ActiveSheet.Name = strBranch
ActiveSheet.Paste
Columns("B:B").EntireColumn.AutoFit
Columns("C:C").EntireColumn.AutoFit
Sheets("Data").Select
Range("A1:K1").Select
Selection.AutoFilter
'Range("E7").Select
End If
Next i
End Sub
j'ai résolu mon problème
Pour ceux que ca interessent voici la macro que j'utilise
Sub SplitSheets()
'
' Macro2 Macro
' Macro recorded 17/11/2006 by f4y840
'
'
Dim strBranch As String 'branchcode
Dim nBranch As Integer 'nbr of branch
nBranch = Sheets("Branch").Cells.Find("*", Range("A1"), , , xlByRows, xlPrevious).Row - 1
For i = 2 To nBranch + 1
strBranch = Sheets("Branch").Cells(i, 1)
If strBranch <> "" Then
Sheets("Data").Select
Range("A1:K1").Select
Selection.AutoFilter
Selection.AutoFilter Field:=1, Criteria1:=strBranch
Range("A1").Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Sheets("Empty").Select
Sheets.Add
'ActiveSheets.Select
ActiveSheet.Name = strBranch
ActiveSheet.Paste
Columns("B:B").EntireColumn.AutoFit
Columns("C:C").EntireColumn.AutoFit
Sheets("Data").Select
Range("A1:K1").Select
Selection.AutoFilter
'Range("E7").Select
End If
Next i
End Sub