How to keep selected text highlighted when focus changes in Microsoft Word/Excel

38,894

Solution 1

This seems to be an exclusive Microsoft "feature". For most projects I only need read-only access and formatting doesn't matter in my case, therefore I have switched to OpenOffice which does not exhibit this behavior.

Solution 2

A quick way to fix half of your problem (when switching from Excel to Word) is to copy the text. When you hit Ctrl + c the cells will continue to be marked (the highligthing is gone, but you still have a dotted line around the text).

A downside to this, is that the text are only marked, as long as you hold the cells copied. Meaning you can't copy anything else or the marking is gone. Unfortunately this will not work from Word to Excel.

Solution 3

This VBa will do it but it assumes you are NOT using highliting. If you are, your highlighting will get messed up so don't use it.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    ActiveCell.Worksheet.Cells.Interior.ColorIndex = xlNone
    ActiveCell.EntireRow.Interior.ColorIndex = 19
End Sub

How do I add VBA in MS Office?


As a massive work around (if the highlighting doesn't work for you), you could use something like JRuler (hear me out :) !! ) as this will allow you to leave the ruler on screen with the row in question above it so when your eyes return to that screen you can see where you were (so you can see, I lost my highlighting but at least I can see I was looking at row 3)!

Don't get me wrong, this is laborious and a pain if you're doing this a lot, but, it may suffice for any program (Word and Excel).

enter image description here

Solution 4

there is no permanent solution to this problem.

a workaround (may get annoying in a while) would be to change the highlighting of the selected cells while they are selected and re-select them again to drop the color.

Stick this code in Sheet1 code behind and go to you spreadsheet and select some cells, select other ones then re-select the first ones to drop the color

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    Dim cell As Range

    For Each cell In Target.Cells
        If cell.Interior.Color = RGB(60, 150, 230) Then
            cell.Interior.Pattern = xlNone
        Else
            cell.Interior.Color = RGB(60, 150, 230)
        End If
    Next
End Sub

Solution 5

After ten years of this problem driving me nuts as well I have finally found a solution that works for me. Unfortunately it is not free... Actual Window Manager has a feature called "Ignore deactivation" which can be enabled for specific apps. This makes the window think it still has focus even when it doesn't. I have this turned on for all office apps and now I can still see the highlighted selection even when another window has focus. I have not had any negative side effects either. I also use multiple monitors and this program has a ton of other useful tools for working with multiple monitors as well that made it worthwhile for me. I installed the trial and then uninstalled it and it offered me 30% off. There may be a free program that does this but I couldn't find one... I hope this helps someone as much as it helped me!

Share:
38,894

Related videos on Youtube

glenneroo
Author by

glenneroo

Updated on September 18, 2022

Comments

  • glenneroo
    glenneroo almost 2 years

    Related to this question: Show cell selection in Excel when not in focus except that my case concerns Microsoft Word.

    When I select text or a column/row in Microsoft Word or Excel (2003, 2007, 2010 or 2013) it shows up highlighted like this in Word:

    enter image description here

    and Excel:

    enter image description here

    However, when I change focus to another program, the highlighted text is no longer highlighted.

    I generally work with 2 monitors, where one monitor contains a document/spreadsheet containing data I need to read, and the other monitor is where I am actually doing work. I will select some text (or cells) to make it stand out amongst the many pages of data, and then switch programs, but the highlighted text is no longer visible.

    Is there a permanent solution to this problem?

  • Admin
    Admin about 10 years
    @DaveRook the idea of of changing the background color on either SelectionChange or Activate event should work for both Excel and Word.
  • CGTheLegend
    CGTheLegend about 7 years
    I don't think this answer merits the best solution. Just using a different application isn't exactly be best solution for everyone.
  • Eugene Mala
    Eugene Mala almost 6 years
    Unfortunately this method does not work for Word 2010 and Windows 7
  • Hartmut Pfarr
    Hartmut Pfarr over 5 years
    I like this solution since MS didn't remove this bug since 100 years
  • Damian Vogel
    Damian Vogel almost 5 years
    Personally I've experienced LibreOffice to be more compatible.
  • Nissim Nanach
    Nissim Nanach over 3 years
    +1 haha nice euphemism "feature"