#1
|
|||
|
|||
Highlight row without affecting existing hihglighting
I use the VBA solution from Pecoflyer's post from 10-23-13 to highlight the row of the current cell and it works. However, if any of the cells are highlighted it removes the highlighting. Is there a ways to highlight the row of the current cell without removing any previous highlights? Edit mod : related to https://www.msofficeforums.com/excel...nt-cell-3.html Last edited by Pecoflyer; 04-09-2016 at 11:27 AM. Reason: New thread |
#2
|
||||
|
||||
I wasn't sure what you meant, Dee; if you highlight a range, it just changes the highlighting from what it was. Did you mean (I wondered) you wanted to highlight all the cells in the current row except those that were already highlighted (perhaps a different color)? That can be done, but it involves looking at each cell in the row and highlighting only those that don't have it already.
But I went back and looked; Peco's solution seems to clear out all highlighting everywhere on the worksheet before highlighting the row. I'm not sure why; that thread was a long time ago and I no longer remember what we may have been thinking then. But if you don't want to do that, this is the culprit: Code:
Target.Parent.Cells.Interior.ColorIndex = 0 Actually, that whole thing can be much simpler, if you prefer: Code:
Private Sub Worksheet_SelectionChange(ByVal org As Range) Target.EntireRow.Interior.ColorIndex = 8 End Sub |
#3
|
||||
|
||||
Hi Dee1
please do not hijack existing threads. You can always create a thread of your own and add a link to the thread it is related to. I created this new thread for you
__________________
Did you know you can thank someone who helped you? Click on the tiny scale in the right upper hand corner of your helper's post |
#4
|
|||
|
|||
Bob,
I didn't explain it well, sorry. What if you have a large spreadsheet and some of the cells are highlighted. I want to highlight the current row without losing any previous highlighted cells. I did try both of the option you suggested and it didn't work for me. I have attached a sample file - Test.xls that shows you what I mean. I really do appreciate the help. Dee1 |
#5
|
||||
|
||||
IIRC an Excel aficionado named Ivan Moala developed such a utility about a decade ago. It would highlight the entire selected column & row, then restore the original formatting once you moved to another cell. IIRC there was a noticeable delay when changing cells, as the code had to: a) search the entire column & row for any existing highlights, so they could be saved; b) restore the highlight states for every cell in the exited row/column; c) re-save the highlights for any cell whose column/row overlapped the previous active cell's column/row; and, finally, apply the temporary highlights. Even that didn't try to preserve existing highlights while the column/row was 'active'. With modern workbooks having so many more rows & columns to handle, I wouldn't be surprised if the task became unmanageably slow.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#6
|
||||
|
||||
Yeah, but Dee is saying the goal is to highlight the row of the selected cell "without losing any previous highlighted cells"; that sounds like all that's needed is my one-statement code snippet below. Granted, that's much too simple; it would end up highlighting every row just from scrolling the cursor up and down.
Dee, your sample just shows a highlighted cell; it doesn't illuminate me much. You say my solution "didn't work"—but how did it not work? Did it bomb with a message? Fail to do anything at all? Do something but not what you wanted? What? |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Change color of existing borders for an existing table | JayUSA | PowerPoint | 1 | 01-21-2016 04:21 PM |
Style affecting other paragraphs around the word I'm trying to change. | Bahamut5098 | Word | 2 | 03-02-2015 01:42 PM |
Applying layout to existing slides without affecting font | mgw130 | PowerPoint | 3 | 12-15-2012 04:38 AM |
Formatting affecting more than selected text | esteban | Word | 7 | 05-25-2012 04:34 AM |
find - reading highlight - highlight all / highlight doesn't stick when saved | bobk544 | Word | 3 | 04-15-2009 03:31 PM |