Find a vlaue, shade another cell

  • Thread starter Thread starter Withnails
  • Start date Start date
W

Withnails

I would like to search column c in an excel sheet for any number that starts
with '46'. all the numbers in the column will be 7 digits long (eg. 4634567)

once found I would like to turn the font blue in the cell 10 columns to the
right of this 46 cell.

the macro should loop down column c until it can find no further values.

any ideas if this is possible?
 
Hi,

Try this

Sub Sonic()
lastRow = Cells(Cells.Rows.Count, "C").End(xlUp).Row
Set MyRange = Range("C1:C" & lastRow)
For Each c In MyRange
If Left(c.Value, 2) = "46" Then
c.Offset(, 10).Font.ColorIndex = 5
End If
Next
End Sub


Mike
 
Hi

Try this:

Sub Color46()
FirstRow = 1
LastRow = Range("C" & Rows.Count).End(xlUp).Row

For r = FirstRow To LastRow
If Left(Range("C" & r), 2) = 46 Then
Range("M" & r).Interior.ColorIndex = 5
End If
Next
End Sub

Regards,
Per
 
Back
Top