ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Highlight Cells (https://www.excelbanter.com/excel-programming/345169-highlight-cells.html)

EMoe[_74_]

Highlight Cells
 

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


--
EMoe
------------------------------------------------------------------------
EMoe's Profile: http://www.excelforum.com/member.php...o&userid=23183
View this thread: http://www.excelforum.com/showthread...hreadid=483546


Tom Ogilvy

Highlight Cells
 
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

--
Regards,
Tom Ogilvy


"EMoe" wrote in message
...

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


--
EMoe
------------------------------------------------------------------------
EMoe's Profile:

http://www.excelforum.com/member.php...o&userid=23183
View this thread: http://www.excelforum.com/showthread...hreadid=483546




Gary''s Student

Highlight Cells
 
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.
--
Gary's Student


"EMoe" wrote:


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


--
EMoe
------------------------------------------------------------------------
EMoe's Profile: http://www.excelforum.com/member.php...o&userid=23183
View this thread: http://www.excelforum.com/showthread...hreadid=483546



EMoe[_75_]

Highlight Cells
 

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


--
EMoe
------------------------------------------------------------------------
EMoe's Profile: http://www.excelforum.com/member.php...o&userid=23183
View this thread: http://www.excelforum.com/showthread...hreadid=483546


Tom Ogilvy

Highlight Cells
 
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.

This is for a long phone number list, that I will use a Find box.


--
Regards,
Tom Ogilvy


"EMoe" wrote in message
...

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


--
EMoe
------------------------------------------------------------------------
EMoe's Profile:

http://www.excelforum.com/member.php...o&userid=23183
View this thread: http://www.excelforum.com/showthread...hreadid=483546




EMoe[_76_]

Highlight Cells
 

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


--
EMoe
------------------------------------------------------------------------
EMoe's Profile: http://www.excelforum.com/member.php...o&userid=23183
View this thread: http://www.excelforum.com/showthread...hreadid=483546


Tom Ogilvy

Highlight Cells
 
Great, don't try to copy and paste on that worksheet.

--
Regards,
Tom Ogilvy


"EMoe" wrote in message
...

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


--
EMoe
------------------------------------------------------------------------
EMoe's Profile:

http://www.excelforum.com/member.php...o&userid=23183
View this thread: http://www.excelforum.com/showthread...hreadid=483546





All times are GMT +1. The time now is 09:01 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com