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

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
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,226,730
Messages
6,192,705
Members
453,748
Latest member
akhtarf3

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