Consulting

Results 1 to 2 of 2

Thread: condtional formatting

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

    condtional formatting

    hello
    i was using the macro recorder to built a macro to highlight various days in a range - beginning in cell I3.how can i make excel use the macro on every range i select:
    [VBA]Application.ScreenUpdating = False
    selection.FormatConditions.Delete
    selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
    "=WEEKDAY(I3)=7"
    With selection.FormatConditions(1).Font
    .Bold = True
    .Italic = False
    .ColorIndex = 3
    End With
    selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
    "=WEEKDAY(I3)=3"
    With selection.FormatConditions(2).Font
    .Bold = True
    .Italic = False
    .ColorIndex = 5
    End With
    selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
    "=WEEKDAY(I3)=6"
    With selection.FormatConditions(3).Font
    .Bold = True
    .Italic = False
    .ColorIndex = 12
    End With
    Application.ScreenUpdating = True[/VBA]
    thanks
    moshe

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    That code does work on a multi-region selection.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •