LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #10   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default conditional formatting

You're welcome. Thanks for the feedback!

--
Biff
Microsoft Excel MVP


"KC" wrote in message
...
Works great and thanks... Sorry it took so long to answer.

"T. Valko" wrote:

Ok, this will place a "X" in the cell and color the cell light yellow
when
selected.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range("A1:A10")) Is Nothing Then
If Target.Interior.ColorIndex = 36 Then '36 = light yellow
Target.Clear
Else
Target.Interior.ColorIndex = 36
Target.Value = "X"
End If
End If
ws_exit:
Application.EnableEvents = True
End Sub

--
Biff
Microsoft Excel MVP


"KC" wrote in message
...
Yes... that will work.

"T. Valko" wrote:

Define: add a value of X

Do you mean to literally enter the character "X" ?

--
Biff
Microsoft Excel MVP


"T. Valko" wrote in message
...
Define: add a value of X


--
Biff
Microsoft Excel MVP


"KC" wrote in message
...
Thanks for your quick reply T. Valko. Macro works great but is it
possible
for the same macro to add a value of X while changing the color for
that
cell?

"T. Valko" wrote:

You can try this event macro. Assume the range of interest is
A1:A10.

Delete any conditional formatting you already have applied to this
range.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range("A1:A10")) Is Nothing Then
If Target.Interior.ColorIndex = 36 Then 'light yellow
Target.Interior.ColorIndex = 0 'white (default)
Else
Target.Interior.ColorIndex = 36
End If
End If
ws_exit:
Application.EnableEvents = True
End Sub

When you select any cell within the defined range it will fill
with a
light
yellow color. If you select that cell again it will remove the
yellow
fill
and return back to white (the default).

To install this macro:

Select the sheet where you want this to happen
Select the sheet tab and select View code
Paste the code into the window that opens
ALT Q to return to Excel


--
Biff
Microsoft Excel MVP


"KC" wrote in message
...
I am creating a simple check sheet which shows what task items
have
been
checked. The boxes have been formatted to turn a color when a
value
greater
than zero has been entered. My question - Is there a way to
change
the
color
by just clicking within the cell with your mouse or is it
maditory
to
input a
value in the cell?















 
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
Protect Cell Formatting including Conditional Formatting Mick Jennings Excel Discussion (Misc queries) 5 November 13th 07 05:32 PM
conditional Formatting based on cell formatting Totom Excel Worksheet Functions 3 January 20th 07 02:02 PM
conditional Formatting based on cell formatting Totom Excel Worksheet Functions 0 January 15th 07 04:35 PM
Conditional Formatting pltplt Excel Discussion (Misc queries) 2 July 25th 06 01:11 PM
Conditional Formatting that will display conditional data BrainFart Excel Worksheet Functions 1 September 13th 05 05:45 PM


All times are GMT +1. The time now is 12:38 PM.

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

About Us

"It's about Microsoft Excel"