Results 1 to 3 of 3

Conditional Formatting with overlapping ranges

Threaded View

  1. #1
    Registered User
    Join Date
    02-04-2017
    Location
    Australia
    MS-Off Ver
    2016
    Posts
    8

    Talking Conditional Formatting with overlapping ranges

    Hi everyone,

    I'm new to VBA programming, but with a lot of searching and studying code examples I have managed to make 3 working macros today. However I am stuck on the last one that I need to create. The aim is to have a macro that deletes and re-establishes our two conditional formatting rules on our sheet. The ranges overlap, and this seems to cause it the macro to stop working. If I run a version of the macro with either 1 rule at a time it works fine. If I run the whole thing with both rules, it gives a runtime error 438 and debug highlights the line ending xlDuplicate.

    Sub ConditionalFormatting()
    '
    ' ConditionalFormatting Macro
    ' Repair Conditional formatting
    '
    ' Keyboard Shortcut: Ctrl+t
    
    
    'Reinstate correct condtional formatting
    
        With Sheets("TnT")
           
           With .Range("B178:L10177")
                 .FormatConditions.Delete
                .FormatConditions.Add xlExpression, Formula1:="=$K178:$K10177<=$F$2+7"
                .FormatConditions(1).Interior.Color = RGB(230, 184, 183)
          End With
          
            With .Range("B178:B10177")
                
                .FormatConditions.AddUniqueValues
        .FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
                .FormatConditions(1).DupeUnique = xlDuplicate
                .FormatConditions(1).Interior.ColorIndex = 46
                .FormatConditions(1).Font.ColorIndex = 3
                .FormatConditions(1).StopIfTrue = False
            End With
            
    
        End With
    
    
    End Sub
    What changes can I implement to get this to work?

    Also, I was hoping someone could please explain to me how this line of code works?
        .FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
    Thank you in advance!!
    Last edited by electricninja; 02-04-2017 at 09:12 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Conditional Formatting - Overlapping Time
    By StartRunMSPaint in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-30-2014, 10:24 AM
  2. Replies: 5
    Last Post: 12-04-2012, 09:48 AM
  3. Looking for Conditional Formatting formula to alert overlapping times
    By lzuke in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-17-2012, 01:08 PM
  4. Overlapping bars with conditional formatting
    By MI_Analyst in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 06-23-2012, 04:52 AM
  5. Replies: 3
    Last Post: 05-15-2012, 04:13 PM
  6. overlapping conditional formatting
    By Xtopher in forum Excel General
    Replies: 8
    Last Post: 09-21-2011, 12:47 AM
  7. Replies: 0
    Last Post: 07-03-2011, 07:52 PM
  8. [SOLVED] vba overlapping conditional formatting
    By Susan J-P in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-11-2006, 01:10 AM

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