Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Hi
I have the following which works perfectly -("Miss" is selected in the range ("C13:G13,M13:Q13") from a validation drop-down list) Private Sub Worksheet_Change(ByVal Target As Excel.Range) For Each myCell In Range("C13:G13,M13:Q13") If myCell.Value = "Miss" Then With myCell.Offset(1) .Interior.ColorIndex = 36 'Light Yellow .BorderAround LineStyle:=xlContinuous, Weight:=xlThin, _ ColorIndex:=11 With .Validation .Delete .Add Type:=xlValidateList, Formula1:="Left,Right,Short,Long" .IgnoreBlank = True .InCellDropdown = True End With End With With myCell.Offset(2) .Interior.ColorIndex = 36 'Light Yellow .BorderAround LineStyle:=xlContinuous, Weight:=xlThin, _ ColorIndex:=11 With .Validation .Delete .Add Type:=xlValidateList, Formula1:="Yes,No" .IgnoreBlank = True .InCellDropdown = True End With End With With myCell.Offset(3) .Interior.ColorIndex = 36 'Light Yellow .BorderAround LineStyle:=xlContinuous, Weight:=xlThin, _ ColorIndex:=11 With .Validation .Delete .Add Type:=xlValidateList, Formula1:="Yes,No" .IgnoreBlank = True .InCellDropdown = True End With End With End If End Sub What I would like to do is add in that when any selection is made from the additional drop-down lists that the formatting of the selection changes to Dark Blue cell interior and White text. Making sense? Any ideas? Sandy |
#2
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Try:
Private Sub Worksheet_Change(ByVal Target As Excel.Range) For Each mycell In Range("C13:G13,M13:Q13") If mycell.Value = "Miss" Then With mycell.Offset(1) .Interior.ColorIndex = 36 'Light Yellow .BorderAround LineStyle:=xlContinuous, Weight:=xlThin, _ ColorIndex:=11 With .Validation .Delete .Add Type:=xlValidateList, Formula1:="Left,Right,Short,Long" .IgnoreBlank = True .InCellDropdown = True End With End With With mycell.Offset(2) .Interior.ColorIndex = 36 'Light Yellow .BorderAround LineStyle:=xlContinuous, Weight:=xlThin, _ ColorIndex:=11 With .Validation .Delete .Add Type:=xlValidateList, Formula1:="Yes,No" .IgnoreBlank = True .InCellDropdown = True End With End With With mycell.Offset(3) .Interior.ColorIndex = 36 'Light Yellow .BorderAround LineStyle:=xlContinuous, Weight:=xlThin, _ ColorIndex:=11 With .Validation .Delete .Add Type:=xlValidateList, Formula1:="Yes,No" .IgnoreBlank = True .InCellDropdown = True End With End With With mycell.Offset(1).Resize(3, 1) .FormatConditions.Delete .FormatConditions.Add Type:=xlCellValue, Operator:=xlGreater, _ Formula1:="0" .FormatConditions(1).Font.ColorIndex = 2 .FormatConditions(1).Interior.ColorIndex = 5 End With End If Next End Sub "Sandy" wrote: Hi I have the following which works perfectly -("Miss" is selected in the range ("C13:G13,M13:Q13") from a validation drop-down list) Private Sub Worksheet_Change(ByVal Target As Excel.Range) For Each myCell In Range("C13:G13,M13:Q13") If myCell.Value = "Miss" Then With myCell.Offset(1) .Interior.ColorIndex = 36 'Light Yellow .BorderAround LineStyle:=xlContinuous, Weight:=xlThin, _ ColorIndex:=11 With .Validation .Delete .Add Type:=xlValidateList, Formula1:="Left,Right,Short,Long" .IgnoreBlank = True .InCellDropdown = True End With End With With myCell.Offset(2) .Interior.ColorIndex = 36 'Light Yellow .BorderAround LineStyle:=xlContinuous, Weight:=xlThin, _ ColorIndex:=11 With .Validation .Delete .Add Type:=xlValidateList, Formula1:="Yes,No" .IgnoreBlank = True .InCellDropdown = True End With End With With myCell.Offset(3) .Interior.ColorIndex = 36 'Light Yellow .BorderAround LineStyle:=xlContinuous, Weight:=xlThin, _ ColorIndex:=11 With .Validation .Delete .Add Type:=xlValidateList, Formula1:="Yes,No" .IgnoreBlank = True .InCellDropdown = True End With End With End If End Sub What I would like to do is add in that when any selection is made from the additional drop-down lists that the formatting of the selection changes to Dark Blue cell interior and White text. Making sense? Any ideas? Sandy |
#3
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Excellent thank you.
Sandy |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macro code to delete conditional formatting | Excel Discussion (Misc queries) | |||
Conditional Formatting in a Macro | Excel Discussion (Misc queries) | |||
Conditional Formatting in Macro | Excel Discussion (Misc queries) | |||
How do I set a date range for conditional formatting in a macro? | Excel Worksheet Functions | |||
Macro/conditional formatting | Excel Discussion (Misc queries) |