Results 1 to 10 of 10

VBA Extending Conditional Formatting Code

Threaded View

  1. #1
    Registered User
    Join Date
    08-24-2015
    Location
    Texas, USA
    MS-Off Ver
    365 MSO (16.0.x.x) 64-bit
    Posts
    15

    Question VBA Extending Conditional Formatting Code

    Unfortunately, I can't figure out a way to accomplish what I want using the Excel GUI. I'm curious if this can be done using VBA code? The code currently marks Duplicate entries in Column D. I'd like it to extend a border around the conditional formatted cell in Column D and the cell directly to its right in Column E. Is this possible?

    What The Code Does
    cf1.png

    What I Would Like The Code To Do
    cf2.png

    Sub Excel_HMMap_Conditional_Formatting_P8()
       lngLastRow = Cells(Rows.Count, "A").End(xlUp).Row
       Range("A1:A" & lngLastRow).Select
       Selection.FormatConditions.AddUniqueValues
       Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
       Selection.FormatConditions(1).DupeUnique = xlDuplicate
       With Selection.FormatConditions(1).Font
           .Bold = True
           .Italic = False
           .Strikethrough = False
           .ThemeColor = xlThemeColorLight1
           .TintAndShade = 0
       End With
       Selection.FormatConditions(1).Borders(xlLeft).LineStyle = xlNone
       Selection.FormatConditions(1).Borders(xlRight).LineStyle = xlNone
       Selection.FormatConditions(1).Borders(xlTop).LineStyle = xlNone
       Selection.FormatConditions(1).Borders(xlBottom).LineStyle = xlNone
       With Selection.FormatConditions(1).Interior
           .PatternColorIndex = xlAutomatic
           .Color = 15527148
           .TintAndShade = 0
       End With
       Selection.FormatConditions(1).StopIfTrue = False
    End Sub
    Last edited by Mulsiphix; 08-30-2015 at 09:20 PM. Reason: Marked as Solved! Thank you 6StringJazzer!!!

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Extending conditional formatting in combination met merged cells
    By jackhays in forum Excel Formulas & Functions
    Replies: 16
    Last Post: 02-10-2015, 09:24 AM
  2. Replies: 5
    Last Post: 02-22-2013, 11:35 PM
  3. Conditional Formatting- extending to whole row
    By rhlongo in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-15-2010, 10:04 PM
  4. Conditional Formatting Code - Deletes Wrong Conditional Format
    By RSpecianJr in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-29-2010, 10:53 AM
  5. Replies: 1
    Last Post: 05-23-2009, 12:54 AM
  6. Extending VBA conditional formatting
    By alpha1980 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 02-29-2008, 07:55 AM
  7. Extending Conditional Formatting
    By SamuelT in forum Excel General
    Replies: 1
    Last Post: 02-12-2007, 04:36 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