Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 04-09-2016, 08:53 AM
Dee1 Dee1 is offline Highlight row without affecting existing hihglighting Windows 10 Highlight row without affecting existing hihglighting Office 2013
Novice
Highlight row without affecting existing hihglighting
 
Join Date: Apr 2016
Posts: 2
Dee1 is on a distinguished road
Default 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
Reply With Quote
  #2  
Old 04-09-2016, 10:33 AM
BobBridges's Avatar
BobBridges BobBridges is offline Highlight row without affecting existing hihglighting Windows 7 64bit Highlight row without affecting existing hihglighting Office 2010 32bit
Expert
 
Join Date: May 2013
Location: USA
Posts: 700
BobBridges has a spectacular aura aboutBobBridges has a spectacular aura about
Default

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
Remove that statement and you should be good.

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
That one statement is all it takes, for something simple like this.
Reply With Quote
  #3  
Old 04-09-2016, 11:28 AM
Pecoflyer's Avatar
Pecoflyer Pecoflyer is offline Highlight row without affecting existing hihglighting Windows 7 64bit Highlight row without affecting existing hihglighting Office 2010 64bit
Expert
 
Join Date: Nov 2011
Location: Brussels Belgium
Posts: 2,779
Pecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant future
Default

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
Reply With Quote
  #4  
Old 04-11-2016, 05:01 PM
Dee1 Dee1 is offline Highlight row without affecting existing hihglighting Windows 10 Highlight row without affecting existing hihglighting Office 2013
Novice
Highlight row without affecting existing hihglighting
 
Join Date: Apr 2016
Posts: 2
Dee1 is on a distinguished road
Default

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
Attached Files
File Type: xls Test.xls (25.0 KB, 12 views)
Reply With Quote
  #5  
Old 04-11-2016, 11:22 PM
macropod's Avatar
macropod macropod is offline Highlight row without affecting existing hihglighting Windows 7 64bit Highlight row without affecting existing hihglighting Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

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]
Reply With Quote
  #6  
Old 04-12-2016, 07:02 AM
BobBridges's Avatar
BobBridges BobBridges is offline Highlight row without affecting existing hihglighting Windows 7 64bit Highlight row without affecting existing hihglighting Office 2010 32bit
Expert
 
Join Date: May 2013
Location: USA
Posts: 700
BobBridges has a spectacular aura aboutBobBridges has a spectacular aura about
Default

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?
Reply With Quote
Reply



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
Highlight row without affecting existing hihglighting 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
Highlight row without affecting existing hihglighting 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

Other Forums: Access Forums

All times are GMT -7. The time now is 06:15 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft