1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
| Public Sub process_file()
Dim foundsheet As Integer
Dim i As Integer
Set ash = ActiveSheet
foundsheet = 0
For i = 1 To ActiveWorkbook.Worksheets.Count
If ActiveWorkbook.Worksheets(i).Name = "Total Dem" Then
foundsheet = i
End If
Next
If foundsheet > 0 Then
' Pour que le mode DEBUG fonctionne, il faut mettre en commentaire
' les 3 lignes suivantes. La copie d'une feuille change le code
' et le mode debug est bloqué
'Application.DisplayAlerts = False
'ActiveWorkbook.Worksheets(foundsheet).Delete
'Application.DisplayAlerts = True
foundsheet = foundsheet - 1
Else
foundsheet = 2
End If
ash.Copy after:=ActiveWorkbook.Worksheets(foundsheet)
Set ash = ActiveWorkbook.Worksheets(foundsheet + 1)
ash.Name = "Total Dem"
Call Stock_Cover_Start
Call CleanSheet
End Sub |
Partager