Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default color of active cell

I have a variant of an earlier post.
I want to change the color of the active cell to yellow, but when the active
cell changes to another cell, I want the cell to revert back to the original
color it was prior to becoming the active cell. - (hope that makes sense!)
Many thanks in advance for making my life easier.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default color of active cell


Robb

I'm not a fan of such (useless) code, but.. If you think it serves a
purpose then put following in the sheet's code module

Option Explicit

Dim rngPrev As Range
Dim idxPrev As Long


Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Count 1 Then Exit Sub
Application.ScreenUpdating = False
If Not rngPrev Is Nothing Then rngPrev.Interior.ColorIndex = idxPrev
Set rngPrev = Target
idxPrev = rngPrev.Interior.ColorIndex
rngPrev.Interior.ColorIndex = 6
Application.ScreenUpdating = True
End Sub




--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


Robb27 wrote :

I have a variant of an earlier post.
I want to change the color of the active cell to yellow, but when the
active cell changes to another cell, I want the cell to revert back
to the original color it was prior to becoming the active cell. -
(hope that makes sense!) Many thanks in advance for making my life
easier.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default color of active cell

Thanks keepITcool. It is just what I needed to help my very non-computer
literate employes very much.

Robb

"keepITcool" wrote:


Robb

I'm not a fan of such (useless) code, but.. If you think it serves a
purpose then put following in the sheet's code module

Option Explicit

Dim rngPrev As Range
Dim idxPrev As Long


Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Count 1 Then Exit Sub
Application.ScreenUpdating = False
If Not rngPrev Is Nothing Then rngPrev.Interior.ColorIndex = idxPrev
Set rngPrev = Target
idxPrev = rngPrev.Interior.ColorIndex
rngPrev.Interior.ColorIndex = 6
Application.ScreenUpdating = True
End Sub




--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


Robb27 wrote :

I have a variant of an earlier post.
I want to change the color of the active cell to yellow, but when the
active cell changes to another cell, I want the cell to revert back
to the original color it was prior to becoming the active cell. -
(hope that makes sense!) Many thanks in advance for making my life
easier.


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,071
Default color of active cell

You do know that XL highlights the selected cell by putting a border
around it *and* changing the color of the associated row & column
numbers.

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions

In article , Robb27
@discussions.microsoft.com says...
I have a variant of an earlier post.
I want to change the color of the active cell to yellow, but when the active
cell changes to another cell, I want the cell to revert back to the original
color it was prior to becoming the active cell. - (hope that makes sense!)
Many thanks in advance for making my life easier.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Active Cell Color Taurien Excel Worksheet Functions 5 August 28th 08 07:53 AM
hOW TO GET COLOR FOR ACTIVE CELL Durga Excel Discussion (Misc queries) 1 October 24th 07 12:12 PM
Color active cell Shen Excel Discussion (Misc queries) 9 October 15th 06 09:17 PM
Active Cell Color jamex Excel Discussion (Misc queries) 1 March 9th 06 07:52 PM
Only want color to show when cell is active riccck Excel Worksheet Functions 1 March 31st 05 10:38 PM


All times are GMT +1. The time now is 08:29 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"