Hello all,
I am using the following code to change a range of cells color based on a specific value.
The following working code colors current cell + 4 cells to right:
cell.Resize(1, 5).Interior.ColorIndex = 4
The following fails when trying to color cells to left:
cell.Resize(1, -13).Interior.ColorIndex = 4
Not sure what i am doing wrong. Ultimately, i want to color cells in the current row from column A to column Q based on cell value of column M.
Full code:
Dim rng As Range, cell As Range
Set rng = Range("M14:M" & intRowCount)
For Each cell In rng
Select Case cell.Value
Case Is <> 0
cell.Interior.ColorIndex = 4
cell.Resize(1, 5).Interior.ColorIndex = 4
cell.Resize(1, -13).Interior.ColorIndex = 4 '<-- produces an error
End Select
Next
Bookmarks