Reputation: 81
This is a very simple problem that I can't seem to find the solution. Basically I use 3 different cell styles (good,neutral and bad). What I simply want to do is I want the cell adjacent to the one I colour coded to be the same colour. For example cell O11 I selected it to be good (green colour), hence cell M11 should automatically change its cell style according to cell O11.
Any suggestions?
P.S O11 will be set manually (no conditional formatting)
Upvotes: 0
Views: 2352
Reputation: 26
To solve your problem you need to create a variable to hold the cells color value and set that value back to another cell. Use the following example:
Sub Copy_Color()
Dim iColor As Long
Dim i as long
for i = 11 to 20
iColor = worksheets("Sheet name").range("M" & i).Interior.Color
worksheets("Sheet name").range("O" & i).Interior.Color = iColor
next
End Sub
Upvotes: 0
Reputation: 26
To solve your problem you need to create a variable to hold the cells color value and set that value back to another cell. Use the following example:`To solve your problem you need to create a variable to hold the cells color value and set that value back to another cell. Use the following example:
To solve your problem you need to create a variable to hold the cells color value and set that value back to another cell. Use the following example:
Sub Copy_Color()
Dim iColor As Long iColor = ActiveCell.Interior.Color ActiveCell.Offset(0, 1).Interior.Color = iColor End Sub
Upvotes: 1