PC Review


Reply
Thread Tools Rate Thread

Clear Cell Fill when leaving Worksheet

 
 
mpb
Guest
Posts: n/a
 
      22nd Jun 2010
Good Morning All,

I am looking for some code to clear a cell fill when leaving the
worksheet.
ie I have a command button which goes to a specific cell on another
worksheet (based on the value in another worksheet) & fills yellow.
Now when I leave the worksheet (and go to another), I would like the
fill to be removed.

Any help, as usual most appreciated.
Cheers
Mathew
 
Reply With Quote
 
 
 
 
Dave Peterson
Guest
Posts: n/a
 
      22nd Jun 2010
There is a worksheet_deactivate event you could tie into:

Option Explicit
Private Sub Worksheet_Deactivate()
Me.Range("A1").Interior.ColorIndex = xlNone
End Sub

Another option would be to use the worksheet_activate event. That way the cell
will have its fill color cleared when you come back to it.

This kind of event code goes in the worksheet module for that sheet.

On 06/22/2010 04:14, mpb wrote:
> Good Morning All,
>
> I am looking for some code to clear a cell fill when leaving the
> worksheet.
> ie I have a command button which goes to a specific cell on another
> worksheet (based on the value in another worksheet)& fills yellow.
> Now when I leave the worksheet (and go to another), I would like the
> fill to be removed.
>
> Any help, as usual most appreciated.
> Cheers
> Mathew


--
Dave Peterson
 
Reply With Quote
 
mpb
Guest
Posts: n/a
 
      22nd Jun 2010
On Jun 22, 11:24*am, Dave Peterson <peter...@XSPAMverizon.net> wrote:
> There is a worksheet_deactivate event you could tie into:
>
> Option Explicit
> Private Sub Worksheet_Deactivate()
> * * *Me.Range("A1").Interior.ColorIndex = xlNone
> End Sub
>
> Another option would be to use the worksheet_activate event. *That way the cell
> will have its fill color cleared when you come back to it.
>
> This kind of event code goes in the worksheet module for that sheet.
>
> On 06/22/2010 04:14, mpb wrote:
>
> > Good Morning All,

>
> > I am looking for some code to clear a cell fill when leaving the
> > worksheet.
> > ie I have a command button which goes to a specific cell on another
> > worksheet (based on the value in another worksheet)& *fills yellow.
> > Now when I leave the worksheet (and go to another), I would like the
> > fill to be removed.

>
> > Any help, as usual most appreciated.
> > Cheers
> > Mathew

>
> --
> Dave Peterson


Thank you very much Dave, always a mine of information.
Did not even realize that there was a Worksheet Activate/Deactivate
Cheers Again
Mathew
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
fill color a protected cell without unprotecting worksheet taibbico Microsoft Excel Worksheet Functions 2 1st Feb 2010 07:44 PM
Why do cell fill colors not show in worksheet view? wisemama Microsoft Excel Worksheet Functions 1 2nd Nov 2009 08:56 PM
How to equal a cell in another worksheet incl fill colour InNeedOfAssistance Microsoft Excel Worksheet Functions 3 21st Apr 2009 08:54 PM
Fill cell with a worksheet name? Adri S. Microsoft Excel Worksheet Functions 4 16th Jan 2008 05:12 PM
fill cell with color from other worksheet =?Utf-8?B?Q3Jha2Vs?= Microsoft Excel Misc 4 19th Apr 2006 05:14 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:28 PM.