+ Reply to Thread
Results 1 to 1 of 1

Conditonal Formatting VB help

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    06-17-2010
    Location
    Leicester
    MS-Off Ver
    Excel 2010
    Posts
    119

    Conditonal Formatting VB help

    Hi,

    A while ago someone on here provided me with the below, but I didn't need it in the end, now I do!

    It formats the colours of rows from cells B:R based on B...all good.

    I'd like a few tweaks if possible:

    1) I have to run the macro each time a change is made, is there a way to make it run itself everytime a cell in column B is changed?
    2) It takes a while to run, as I assume it working it's way down through every row, is there a way to limit from say row 1 to 500?
    3) General query - how do I assign a key command to run the macro.

    Sorry for all the questions, hopefully if I can get this working I can apply this to a template and use it on many spreadsheets, saving me alot of time day to day!

    Thanks,

    Dan



    Sub HighlightExisting()
    
    Dim Cll As Range
    
    For Each Cll In Range("B:B")
    
        Select Case Cll
        
        Case Is = "IGNORE"
            Range("B" & Cll.Row & ":R" & Cll.Row).Interior.ColorIndex = 10
        
        Case Is = "To Be Done"
            Range("B" & Cll.Row & ":R" & Cll.Row).Interior.ColorIndex = 16
            
        Case Is = "Pass"
            Range("B" & Cll.Row & ":R" & Cll.Row).Interior.ColorIndex = 9
        
        Case Is = "Fail"
            Range("B" & Cll.Row & ":R" & Cll.Row).Interior.ColorIndex = 3
            
        Case Is = "In Progress"
            Range("B" & Cll.Row & ":R" & Cll.Row).Interior.ColorIndex = 5
            
        Case Else
            Range("B" & Cll.Row & ":R" & Cll.Row).Interior.Pattern = xlNone
        
        End Select
    
    Next Cll
    
    End Sub
    Last edited by dshilan; 08-23-2011 at 09:00 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1