Loading
Ozgrid Excel Help & Best Practices Forums

Excel Training / Excel Dashboards Reports



Results 1 to 5 of 5

Thread: USD 20 VBA code to color cells if it meets percentage range conditions

  1. #1
    Join Date
    26th May 2017
    Posts
    6

    USD 20 VBA code to color cells if it meets percentage range conditions

    Hello! Need help in creating a macro that will color code cells in Col N and Col P if it meets the below criteria:

    • 0-50% - red
      50-75%- yellow
      75%-up- green





    Transaction ID: 535857935X6354151

    Thank you!
    Attached Files. REMINDER! OzGrid accepts no responsibility for ANY adverse effects as a result from downloading attached files. ALWAYS run an up-to-date virus scan and disable macros.

  2. #2
    Join Date
    2nd March 2010
    Location
    God's Own Country
    Posts
    3,998

    Re: VBA code to color cells if it meets percentage range conditions $20

    I'll have a look and let you know if I can help.

  3. #3
    Join Date
    2nd March 2010
    Location
    God's Own Country
    Posts
    3,998

    Re: VBA code to color cells if it meets percentage range conditions $20

    Don't worry about the payment. Use this code. By the way, your existing code which does your other work is highly inefficient. Can be done in a much more easier (read efficient) manner

    VB:
    Sub ColorFormat() 
         
         
        Set objCF = Application.Union(Range("N2:N" & Range("N" & Rows.Count).End(xlUp).Row), Range("P2:P" & Range("P" & Rows.Count).End(xlUp).Row)) 
        With objCF 
            .FormatConditions.Delete 
            With .FormatConditions.Add(xlCellValue, xlGreater, "=0.75") 
                .Interior.Color = 5287936 
            End With 
            With .FormatConditions.Add(xlCellValue, xlLess, "=0.5") 
                .Interior.Color = 255 
            End With 
            With .FormatConditions.Add(xlCellValue, xlBetween, "=0.5", "=0.75") 
                .Interior.Color = 49407 
            End With 
        End With 
         
    End Sub 
    
    

  4. #4
    Join Date
    26th May 2017
    Posts
    6

    Re: VBA code to color cells if it meets percentage range conditions $20

    Thank you so much SMC!

  5. #5
    Join Date
    2nd March 2010
    Location
    God's Own Country
    Posts
    3,998

    Re: VBA code to color cells if it meets percentage range conditions $20

    Cheers mate

Thread Information

Users Browsing this Thread

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

Possible Answers

  1. Replies: 3
    Last Post: May 27th, 2017, 10:54
  2. Loop Through Range If Cell Meets 1 Of X Conditions
    By Robin_Hudson in forum Excel General
    Replies: 2
    Last Post: May 19th, 2010, 17:42
  3. Color Cells Where Cell Below Meets Date Criteria
    By vfavoretto in forum Excel General
    Replies: 7
    Last Post: November 21st, 2007, 09:28
  4. Color Cells Within Tolerance Percentage
    By ozsupra in forum Excel General
    Replies: 8
    Last Post: September 14th, 2007, 10:27
  5. Color Cells By More Than 3 Conditions
    By Alabrax in forum Excel General
    Replies: 2
    Last Post: September 13th, 2007, 23:18

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
  •  
porno