ColorIndex and Offset

rinneii

New Member
Joined
Mar 20, 2019
Messages
18
I need to use the offset property to get color in another column. This is what I have so far:

Option Explicit
Dim FinalRow As Integer
Dim i As Integer
Sub Colorfruit()
FinalRow = Cells(Rows.Count, 1).End(xlUp).Row
For i = 3 To FinalRow
If Cells(i, 1).Value = "Grapefruit" Then
With Cells(i, 1).Offset(, 1)
If .Value >= 8 Then
.Interior.ColorIndex = 35
End If
End With
End If
Next i
End Sub

My goal is to have only 1 With block. In total I have 3 columns A-C.

Any help would be very much appreciated!
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
Here's a picture of my spreadsheet: https://sta.sh/01b079nwism2
01b079nwism2
 
Upvote 0
Try
Code:
If .Value >= 8 Then
Cells(i, 1).Resize(1, 3).Interior.ColorIndex = 35
 
Upvote 0
Solution

Forum statistics

Threads
1,224,819
Messages
6,181,153
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top