-
conditional format color
hello
this macro color every 4th row in a selection.
how can i let the user choose a color?
[VBA]
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
[/VBA]
thanks
moshe
-
[vba]
'-----------------------------*------------------------------*----------------
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
[/vba]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules