Highlight Cells

  • Thread starter Thread starter EMoe
  • Start date Start date
E

EMoe

Good Morning Programmers,

I am looking for a code that will put a color (say yellow) in the
active cell, but also the next 2 to 3 cells to the right of the active
cell. Or maybe it possibe to highlight the entire row of an active
cell, that would be good also.

This is for a long phone number list, that I will use a Find box. Once
the box moves over the name that is found, highlight the entire row.
Wherever the active cell is located, highlight that row.

Thanks,
EMoe
 
Cells.Interior.ColorIndex = xlNone
set rng = Columns(3).Find("1234567")
if not rng is nothing then
rng.Select
rng.EntireRow.Interior.ColorIndex = 6
End if
 
Hi:

Sub Macro1()
i = Selection.Row
j = Selection.Column
Range(Cells(i, j), Cells(i, j + 2)).Select
With Selection.Interior
.ColorIndex = 6
End With
End Sub

will color the selected cell and the next couple of cells to the right.
Will run if one cell is selected for each macro run.
 
Thanks for the reply.

Tom, I tried your code, and I couldn't get anything to happen.
Gary, your code runs with the macro to highlight the cells
permanently.

I'm looking for some sort of *change event * that whenever the active
cell is moved, via the arrow keys or mouse, that corresponding row
becomes highlighted. Then changes as the active cell is moved.

I saw a code once that highlights the cell that is active, but I need
the entire row to become highlighted.

Thanks,
EMoe
 
Did you have the string "1234567" in column 3 or did you change it to look
for a phone number in the proper column? You said you were trying to find a
number.
 
Tom with the box, I will search for a name that is in column one. The
phone number associated with that name is located in column 3. I don't
quit understand what you mean by using 1234567 as a string though.

I would love to see your explanation, however I was able to come across
this code:

Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
Static rr
If rr <> "" Then
With Rows(rr).Interior
..ColorIndex = xlNone
End With
End If
r = Selection.Row
rr = r

With Rows(r).Interior
..ColorIndex = 6
..Pattern = xlSolid
End With
End Sub


Thanks,
EMoe
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top