Guest User

Untitled

a guest
Jun 23rd, 2018
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Sub Botão52_Click()
  2. Dim proteins As Integer
  3. Dim carbs As Integer
  4. Dim fat As Integer
  5. Dim cals As Integer
  6. Dim dia As Integer
  7. Dim mes As Integer
  8. Dim ano As Integer
  9. Dim x As Integer
  10. Dim y As Integer
  11. Dim Count As Integer
  12.  
  13. proteins = carbs = fat = cals = 0
  14.  
  15. Count = Application.CountA(Range("A:A"))
  16.  
  17. For i = 4 To Count - 2
  18.  If Cells(i, 2).Value = "" Then
  19.  Else
  20. If Cells(i, 7).Value = True Then
  21. proteins = proteins + Cells(i, 2).Value
  22. carbs = carbs + Cells(i, 3).Value
  23. fat = fat + Cells(i, 4).Value
  24. cals = cals + Cells(i, 5).Value
  25. End If
  26. End If
  27. Next i
  28.  
  29.  Cells(4, 10).Value = proteins
  30.  Cells(4, 11).Value = carbs
  31.  Cells(4, 12).Value = fat
  32.  Cells(4, 13).Value = cals
  33.  
  34.  For i = 0 To 3
  35.  
  36.  Select Case i
  37.  
  38.    Case 0
  39.      x = 2
  40.      y = 17
  41.    Case 1
  42.      x = 2
  43.      y = 30
  44.    Case 2
  45.      x = 2
  46.      y = 24
  47.    Case 3
  48.    x = 2
  49.    y = 11
  50.  
  51.   Case Else
  52.  
  53. End Select
  54.  
  55.  If Cells(4, 10 + i).Value < Worksheets("MacroNutrients").Range("B1:B30").Cells(y).Value Then
  56.  Cells(6, 10 + i).Value = "-"
  57.  Cells(6, 10 + i).Interior.ColorIndex = 3
  58.  Cells(5, 10 + i).Value = Abs(Cells(4, 10 + i).Value - Worksheets("MacroNutrients").Range("B1:B30").Cells(y).Value)
  59.  ElseIf Cells(4, 10).Value > Worksheets("MacroNutrients").Range("B1:B30").Cells(y).Value Then
  60.  Cells(6, 10 + i).Value = "+"
  61.  Cells(6, 10 + i).Interior.ColorIndex = 35
  62.  Cells(5, 10 + i).Value = Cells(4, 10 + i).Value - Worksheets("MacroNutrients").Range("B1:B30").Cells(y).Value
  63.  End If
  64.  Next i
  65.  
  66.  
  67.  dia = Day(Date)
  68.  mes = Month(Date)
  69.  ano = Year(Date)
  70.  
  71.  
  72.  
  73. End Sub
  74. Sub Botão53_Click()
  75.  
  76. Dim Count As Integer
  77. Count = Application.CountA(Range("A:A"))
  78.  
  79. For i = 4 To Count + 2
  80. Range("G:G").Cells(i).Value = False
  81. Next i
  82.  
  83. For i = 0 To 2
  84.  Cells(4 + i, 10).Value = ""
  85.  Cells(4 + i, 11).Value = ""
  86.  Cells(4 + i, 12).Value = ""
  87.  Cells(4 + i, 13).Value = ""
  88.  Next i
  89.  
  90. End Sub
Add Comment
Please, Sign In to add comment