Advertisement
Guest User

Untitled

a guest
Sep 22nd, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. Private Sub Worksheet_SelectionChange(ByVal Target As Range)
  2. Application.ScreenUpdating = False
  3. Dim cell As Range
  4. 'Turn off ScreenUpdating (speeds up code)
  5. Application.ScreenUpdating = False
  6.  
  7. 'Loop through each cell in the ActiveSheet
  8. For Each cell In ActiveSheet.UsedRange
  9.  
  10. 'Check for a specific fill color
  11. If cell.Interior.Color = RGB(255, 255, 0) Then
  12.  
  13. 'Remove Fill Color
  14. cell.Interior.Color = xlNone
  15.  
  16. End If
  17.  
  18. Next cell
  19. ' Highlight the active cell
  20. Target.Interior.ColorIndex = 6
  21. Application.ScreenUpdating = True
  22. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement