Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Changing cell color by clicking the cell

I have a vacation schedule for employees. As they turn in a vacation request,
I add it to the spreadsheet as pending. Once it is approved by management, I
would like to click the cell and have it turn green and the letter 'A' appear
as approved. If it is denied, the cell should be turned red and the letter
'D' inserted. The original input cell has a '1', '2', '3' (ist, 2nd, 3rd
chocie) or a V as a non-choice vacation (usually a one day request. The
pending status is always normal white cell shading. Is there any way of
cycling through the cell color choices....green to red...as I click on the
cell ? I'm sure I would have to do each cell separatly (2 week vacation, for
example) but that would still be easier than highlighting and re-typing every
cell. I did notice a 2007 posting for changing from one color to the next,
but not sure about cycling through with multiple choices.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Changing cell color by clicking the cell

This code works off of right click. If you right click in column A row 3 or
more then it changes the colour. Right click the sheet tab you want and
select view code. Paste this into the code window...

Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As
Boolean)
If Target.Count 1 Then Exit Sub
If Target.Column = 1 And Target.Row = 3 Then
Cancel = True
With Target.Interior
Select Case Target.Interior.ColorIndex
Case xlNone
.ColorIndex = 3
Case 3
.ColorIndex = 6
Case 6
.ColorIndex = 4
Case 4
.ColorIndex = xlNone
End Select
End With
End If
End Sub
--
HTH...

Jim Thomlinson


"HarveyM." wrote:

I have a vacation schedule for employees. As they turn in a vacation request,
I add it to the spreadsheet as pending. Once it is approved by management, I
would like to click the cell and have it turn green and the letter 'A' appear
as approved. If it is denied, the cell should be turned red and the letter
'D' inserted. The original input cell has a '1', '2', '3' (ist, 2nd, 3rd
chocie) or a V as a non-choice vacation (usually a one day request. The
pending status is always normal white cell shading. Is there any way of
cycling through the cell color choices....green to red...as I click on the
cell ? I'm sure I would have to do each cell separatly (2 week vacation, for
example) but that would still be easier than highlighting and re-typing every
cell. I did notice a 2007 posting for changing from one color to the next,
but not sure about cycling through with multiple choices.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Changing cell color by clicking the cell


migod Jim, that was very easy..Thanks ! I just added an ActiveCell = (letter)
to each line to get the (A)pproved, (D)enied, (P)ending status to show up

Thanks again

"Jim Thomlinson" wrote:

This code works off of right click. If you right click in column A row 3 or
more then it changes the colour. Right click the sheet tab you want and
select view code. Paste this into the code window...

Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As
Boolean)
If Target.Count 1 Then Exit Sub
If Target.Column = 1 And Target.Row = 3 Then
Cancel = True
With Target.Interior
Select Case Target.Interior.ColorIndex
Case xlNone
.ColorIndex = 3
Case 3
.ColorIndex = 6
Case 6
.ColorIndex = 4
Case 4
.ColorIndex = xlNone
End Select
End With
End If
End Sub
--
HTH...

Jim Thomlinson


"HarveyM." wrote:

I have a vacation schedule for employees. As they turn in a vacation request,
I add it to the spreadsheet as pending. Once it is approved by management, I
would like to click the cell and have it turn green and the letter 'A' appear
as approved. If it is denied, the cell should be turned red and the letter
'D' inserted. The original input cell has a '1', '2', '3' (ist, 2nd, 3rd
chocie) or a V as a non-choice vacation (usually a one day request. The
pending status is always normal white cell shading. Is there any way of
cycling through the cell color choices....green to red...as I click on the
cell ? I'm sure I would have to do each cell separatly (2 week vacation, for
example) but that would still be easier than highlighting and re-typing every
cell. I did notice a 2007 posting for changing from one color to the next,
but not sure about cycling through with multiple choices.

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
Changing Cell Color by clicking on a cell JEB Excel Programming 2 August 15th 07 01:30 PM
Changing cell text color based on cell number W. Wheeler Excel Programming 0 April 22nd 07 11:56 PM
Cell colors or text color changing when date in cell gets closer. Chase Excel Worksheet Functions 5 October 19th 06 08:57 AM
Code for making a cell chage color by dbl clicking, with either a Zan Dorris Excel Programming 1 February 13th 06 04:00 PM
changing cell value by double clicking it with out vba/macros ntl.news.com Excel Programming 1 November 19th 05 11:23 PM


All times are GMT +1. The time now is 02:12 AM.

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"