![]() |
#5
|
||||
|
||||
![]()
Right, these are the two codes that I copied, the first from Pecoflyer's post and the other from another forum.
Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Target.Cells.Count > 1 Then Exit Sub Application.ScreenUpdating = False ' Clear the color of all the cells Cells.Interior.ColorIndex = 0 With Target ' Highlight the entire row and column that contain the active cell .EntireRow.Interior.ColorIndex = 23 .EntireColumn.Interior.ColorIndex = 37 End With Application.ScreenUpdating = True End Sub Option Explicit Private Sub Worksheet_SelectionChange(ByVal Target As Range) Dim RngRow As Range Dim RngCol As Range Dim RngFinal As Range Dim Row As Long Dim Col As Long Cells.Interior.ColorIndex = xlNone Row = Target.Row Col = Target.Column Set RngRow = Range("A" & Row, Target) Set RngCol = Range(Cells(1, Col), Target) Set RngFinal = Union(RngRow, RngCol) RngFinal.Interior.ColorIndex = 8 End Sub I guess there is a code that needs to be inserted so that the highlighting will be disabled before printing, that it will not show in the hard copy. Thank you. |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Adding a function to this macro: | JohnGanymede | Excel Programming | 6 | 12-22-2017 02:57 PM |
![]() |
Ulodesk | Word VBA | 4 | 03-07-2016 01:40 PM |
![]() |
OTPM | Project | 4 | 08-22-2013 01:33 PM |
![]() |
etippelt | Word VBA | 6 | 04-08-2013 05:55 PM |
Macro for automatically adding filename without .doc | RPM7 | Word VBA | 0 | 04-29-2010 01:43 AM |