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 35
| Private Sub nouvellefeuille_Click()
Dim shFact As Worksheet, shNew As Worksheet, wbNew As Workbook
Set shFact = Sheets("Facturation")
Set shNew = Sheets.Add
Dim Mot As String
Dim nom, chemin As String
shFact.Cells.Copy
shNew.Range("A1").PasteSpecial xlPasteValues
shNew.Range("A1").PasteSpecial xlPasteFormats
shNew.Move
nom = Sheets("facturation").Range("D17").Value & "-" & Sheets("facturation").Range("J5").Value & ".xls"
filename: chemin = "C:\Save_Devis_ExcelGStock\Devis"
ActiveWorkbook.SaveAs filename:=chemin & "\" & nom, _
FileFormat:=xlExcel8, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
If [MTTC].Row - 9 > 19 Then
shFact.Range("C19:C" & [MTTC].Row - 9).EntireRow.Delete
ElseIf [MTTC].Row - 9 = 19 Then
shFact.Range("C19").EntireRow.Clear
End If
shFact.Range("J5:J8").ClearContents
shFact.Range("D17").ClearContents
Select Case UCase(shFact.Range("D1"))
Case Is = "FACTURE"
Range("S7") = Range("S7") + 1
Case Is = "DEVIS"
Range("S8") = Range("S8") + 1
End Select
End Sub |