How can i change the color of the cells that i select with VBA?
I want to make any selection, then click a button and then the background color of that selection should change.
Got this
It works to toggle between colors
but only work on one cell at a time
how to make it work on all cells that i randomly select?
a big bonus would also to be able to limit this command to only work in a specific range.
something like "if selection is not in range then do nothing"
I want to make any selection, then click a button and then the background color of that selection should change.
Got this
Code:
If ActiveCell.Interior.ColorIndex = 18 Then
ActiveCell.Interior.ColorIndex = 0
Else
activcell.Interior.ColorIndex = 18
End If
It works to toggle between colors
but only work on one cell at a time
how to make it work on all cells that i randomly select?
a big bonus would also to be able to limit this command to only work in a specific range.
something like "if selection is not in range then do nothing"
Last edited: