how to search, select, change color of cells

bruinscup11

New Member
Joined
Jun 23, 2011
Messages
5
I have a spreadsheet of almost 90,000 rows, I need to get the data down to 11,000. I want to be able to (using VBA) search the data in column F (Range F15:F89905), select the cells whose values are equal to those in column I (Range I10:I11244), then change the fill color of the selected cell to a different color like color index 36.
(I will later filter the data in column F and make sure the values are equal before deleting the excess data points)
I am really new at VBA, and have no idea how to go about coding this. Could anyone help me figure out how to do this?
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
also I forgot to say: I am using excel 2007

Although I'm using 2003, and there are probably better ways but, maybe this will work.

Code:
Sub bruinscup11()

Dim x As Long
Dim r As Variant

For x = 11244 To 10 Step -1

r = Range("I" & x).Value

With Range("G15:G89905")

    .AutoFilter Field:=1, Criteria1:=r
    .SpecialCells(xlCellTypeVisible).Interior.ColorIndex = 36
    .AutoFilter
    
End With
    
Next x

End Sub
 
Upvote 0

Forum statistics

Threads
1,224,597
Messages
6,179,808
Members
452,944
Latest member
2558216095

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