Consulting

Results 1 to 3 of 3

Thread: Solved: Painting cells meeting conditions VBA

  1. #1
    VBAX Tutor
    Joined
    Sep 2009
    Posts
    231
    Location

    Solved: Painting cells meeting conditions VBA

    I want to paint the cells for which conditions is met that is the end date and delivery date equal to that to the calendar date.

    I know it’s easier with conditional formatting as I have done it in the example attached to show this.

    But my problem is on my data I have already used the 3 conditions formatting and the only option now is to do it with VBA.

    Can someone just guide of how can I do this with VBA.

    Please have a look at my attachement.

    Many thanks for the help.

    Attached Files Attached Files

  2. #2
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    Is this what you are after?
    [VBA]Sub Formats()
    Dim r As Range
    Dim cel As Range
    Set r = Range("E7:V29")
    For Each cel In r
    If Cells(cel.Row, 2) = Cells(5, cel.Column) Then cel.Interior.ColorIndex = 3
    If Cells(cel.Row, 3) = Cells(5, cel.Column) Then cel.Interior.ColorIndex = 4
    Next
    End Sub
    [/VBA]
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  3. #3
    VBAX Tutor
    Joined
    Sep 2009
    Posts
    231
    Location
    Hi,

    thanks a lot this i wanted to do.

    solved.

Posting Permissions

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