Advertisement
Guest User

Untitled

a guest
Aug 21st, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. Sub SetGrade2()
  2.  
  3.  
  4. Dim AMenor As Integer
  5. Dim AMaior As Integer
  6. Dim BMenor As Integer
  7. Dim BMaior As Integer
  8. Dim FMenor As Integer
  9. Dim FMaior As Integer
  10.  
  11.  
  12. AMenor = Cells(2, 11).Value
  13. AMaior = Cells(2, 12).Value
  14. BMenor = Cells(3, 11).Value
  15. BMaior = Cells(3, 12).Value
  16. FMenor = Cells(4, 11).Value
  17. FMaior = Cells(4, 12).Value
  18.  
  19.  
  20. Do While ActiveCell.Value <> ""
  21. If ActiveCell.Value <> "" Then
  22. ActiveCell.Offset(1, 0).Select
  23. End If
  24.  
  25. If ActiveCell.Value >= AMenor And ActiveCell.Value <= AMaior Then
  26. ActiveCell(1, 2).Value = "A"
  27. ActiveCell(1, 2).Interior.ColorIndex = 4
  28. ActiveCell(1, 2).HorizontalAlignment = xlCenter
  29. ActiveCell(1, 2).VerticalAlignment = xlCenter
  30.  
  31. ElseIf ActiveCell.Value >= BMenor And ActiveCell.Value <= BMaior Then
  32. ActiveCell(1, 2).Value = "B"
  33. ActiveCell(1, 2).Interior.ColorIndex = 44
  34. ActiveCell(1, 2).HorizontalAlignment = xlCenter
  35. ActiveCell(1, 2).VerticalAlignment = xlCenter
  36.  
  37.  
  38. ElseIf ActiveCell.Value >= FMenor And ActiveCell.Value <= BMaior Then
  39. ActiveCell(1, 2).Value = "F"
  40. ActiveCell(1, 2).Interior.Color = RGB(255, 0, 0)
  41. ActiveCell(1, 2).HorizontalAlignment = xlCenter
  42. ActiveCell(1, 2).VerticalAlignment = xlCenter
  43. ActiveCell(1, 1).Interior.Color = RGB(255, 0, 0)
  44. ActiveCell(1, 0).Interior.Color = RGB(255, 0, 0)
  45.  
  46. End If
  47. Loop
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement