Advertisement
Guest User

Untitled

a guest
Apr 22nd, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Sub btnRevenusMois()
  2. Dim i As Integer: i = 4
  3. Dim dernierMois As Integer: dernierMois = Format(DateAdd("m", -1, Date), "mm")
  4. Dim sTot As Double
  5. Dim tps As Double
  6. Dim tvq As Double
  7. Dim total As Double
  8.  
  9. While Not IsEmpty(Cells(i, 1))
  10.     If Month(Cells(i, 1)) = dernierMois Then
  11.         sTot = sTot + Cells(i, 4)
  12.         tps = tps + Cells(i, 5)
  13.         tvq = tvq + Cells(i, 6)
  14.         total = total + Cells(i, 7)
  15.        
  16.         Rows(i).EntireRow.Copy
  17.         Worksheets("data").Select
  18.         Worksheets("data").Range("A" + CStr(i)).Select
  19.         Worksheets("data").Paste
  20.         Worksheets("Ventes").Select
  21.         Application.CutCopyMode = False
  22.     End If
  23. i = i + 1
  24. Wend
  25.  
  26.  
  27.  
  28.  
  29. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement