Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Shade a cell
I need a cell to get shaded when i click on it. how can i do that?
|
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Shade a cell
'----------------------------------------------------------------
Private Sub Worksheet_SelectionChange(ByVal Target As Range) '---------------------------------------------------------------- Cells.FormatConditions.Delete With Target .FormatConditions.Delete .FormatConditions.Add Type:=xlExpression, Formula1:="TRUE" .FormatConditions(1).Interior.ColorIndex = 36 End With End Sub 'This is worksheet event code, which means that it needs to be 'placed in the appropriate worksheet code module, not a standard 'code module. To do this, right-click on the sheet tab, select 'the View Code option from the menu, and paste the code in. -- HTH Bob Phillips (replace somewhere in email address with gmail if mailing direct) "Lavanya" wrote in message ... I need a cell to get shaded when i click on it. how can i do that? |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
Shade a cell
Caution!!
This will, of course, "destroy" any and all other conditional formatting you have or need to maintain in the sheet. "Bob Phillips" wrote: '---------------------------------------------------------------- Private Sub Worksheet_SelectionChange(ByVal Target As Range) '---------------------------------------------------------------- Cells.FormatConditions.Delete With Target .FormatConditions.Delete .FormatConditions.Add Type:=xlExpression, Formula1:="TRUE" .FormatConditions(1).Interior.ColorIndex = 36 End With End Sub 'This is worksheet event code, which means that it needs to be 'placed in the appropriate worksheet code module, not a standard 'code module. To do this, right-click on the sheet tab, select 'the View Code option from the menu, and paste the code in. -- HTH Bob Phillips (replace somewhere in email address with gmail if mailing direct) "Lavanya" wrote in message ... I need a cell to get shaded when i click on it. how can i do that? |
#4
Posted to microsoft.public.excel.misc
|
|||
|
|||
Shade a cell
|
#6
Posted to microsoft.public.excel.misc
|
|||
|
|||
Shade a cell
Dave,
Test it. You can even add new. -- Don Guillett SalesAid Software "Dave Peterson" wrote in message ... You sure? Application.Cells.FormatConditions.Delete Looks like it would destroy any existing conditional formats. Don Guillett wrote: The one I posted will NOT -- Don Guillett SalesAid Software "JMay" wrote in message ... Caution!! This will, of course, "destroy" any and all other conditional formatting you have or need to maintain in the sheet. "Bob Phillips" wrote: '---------------------------------------------------------------- Private Sub Worksheet_SelectionChange(ByVal Target As Range) '---------------------------------------------------------------- Cells.FormatConditions.Delete With Target .FormatConditions.Delete .FormatConditions.Add Type:=xlExpression, Formula1:="TRUE" .FormatConditions(1).Interior.ColorIndex = 36 End With End Sub 'This is worksheet event code, which means that it needs to be 'placed in the appropriate worksheet code module, not a standard 'code module. To do this, right-click on the sheet tab, select 'the View Code option from the menu, and paste the code in. -- HTH Bob Phillips (replace somewhere in email address with gmail if mailing direct) "Lavanya" wrote in message ... I need a cell to get shaded when i click on it. how can i do that? -- Dave Peterson |
#7
Posted to microsoft.public.excel.misc
|
|||
|
|||
Shade a cell
Right click sheet tabview codeinsert this
'McCurdy.Here is something inspired by Don Guillett. Private Sub Worksheet_selectionChange(ByVal Target As Range) Dim MyRng As Range Set MyRng = Target '.EntireRow Application.EnableEvents = False On Error GoTo end1 Application.Cells.FormatConditions.Delete 'Application.Cells.Font.Size = 10 With MyRng .FormatConditions.Add Type:=xlExpression, Formula1:= _ "=ROW()=ROW(INDIRECT(CELL(""address"")))" With .FormatConditions(1).Font .Bold = True .Italic = False .ColorIndex = 1 End With '.Font.Size = 20 .FormatConditions(1).Interior.ColorIndex = 36 End With end1: Application.EnableEvents = True End Sub -- Don Guillett SalesAid Software "Lavanya" wrote in message ... I need a cell to get shaded when i click on it. how can i do that? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
insert date | Excel Worksheet Functions | |||
Compiling macro based on cell values | Excel Discussion (Misc queries) | |||
Urgent date/scheduling calc needed | Excel Worksheet Functions | |||
Shade cell according to text? | Excel Discussion (Misc queries) | |||
Copy cell format to cell on another worksht and update automatical | Excel Worksheet Functions |