Advertisement
Guest User

Untitled

a guest
Aug 21st, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. Private Sub Worksheet_Change(ByVal Target As Range)
  2. If Target.Count > 1 Then Exit Sub
  3. If Not Intersect(Range("a33", "f36"), Target) Is Nothing Then
  4. setColor Target.Column
  5. End If
  6. End Sub
  7.  
  8. Sub setColor(col As Integer)
  9. Dim vDB, vColor
  10. Dim i As Integer, c As Integer, n As Integer
  11.  
  12. vColor = Array(RGB(244, 185, 79), RGB(0, 180, 255), RGB(255, 54, 54), RGB(116, 211, 109))
  13. Range(Cells(1, col), Cells(32, col)).Interior.Color = RGB(36, 36, 36)
  14. vDB = Cells(33, col).Resize(4)
  15. For i = 1 To 4
  16. n = vDB(i, 1)
  17. c = c + n
  18. If IsEmpty(n) Then
  19. Else
  20. Cells(32, col).Offset(-c, 0).Resize(n).Interior.Color = vColor(i - 1)
  21. End If
  22. Next i
  23.  
  24. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement