Consulting

Results 1 to 2 of 2

Thread: conditional format color

  1. #1
    VBAX Mentor
    Joined
    Jun 2005
    Posts
    374
    Location

    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

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master xld's Avatar
    Joined
    Apr 2005
    Posts
    25,147
    Location
    [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
  •