PDA

View Full Version : conditional format color



lior03
05-16-2006, 02:03 AM
hello
this macro color every 4th row in a selection.
how can i let the user choose a color?

Application.ScreenUpdating = False
Range("A1").Select
selection.CurrentRegion.Select
selection.FormatConditions.Delete
selection.FormatConditions.Add Type:=xlExpression, Formula1:="=MOD(ROW(),4)=1"
With selection.FormatConditions(1).Font
.Bold = True
.Italic = True
.ColorIndex = 3
End With
selection.FormatConditions(1).Interior.ColorIndex = Application.Dialogs(xlDialogConditionalFormatting).Show
Application.ScreenUpdating = True


thanks

Bob Phillips
05-16-2006, 04:14 AM
'-----------------------------*------------------------------*----------------
Function GetColorindex(Optional Text As Boolean = False) As Long
'-----------------------------*------------------------------*----------------
Dim rngCurr As Range

Set rngCurr = Selection
Application.ScreenUpdating = False
Range("IV1").Select
Application.Dialogs(xlDialogPatterns).Show
GetColorindex = ActiveCell.Interior.ColorIndex
If GetColorindex = xlColorIndexAutomatic And Not Text Then
GetColorindex = xlColorIndexNone
End If
ActiveCell.Interior.ColorIndex = xlColorIndexAutomatic
rngCurr.Select
Set rngCurr = ActiveSheet.UsedRange
Application.ScreenUpdating = True
End Function