+ Reply to Thread
Results 1 to 8 of 8

VBA Conditional formatting to delete entire row when two variable are ture

Hybrid View

  1. #1
    Registered User
    Join Date
    08-01-2011
    Location
    Tasmania, Australia
    MS-Off Ver
    Excel 2007
    Posts
    12

    Question Re: VBA Conditional formatting to delete entire row when two variable are ture

    Hi SOS, thanks for the response. I'm still having a little trouble getting it to compile - errors all over the place due to my existing code.

    How would I incorporate your code in to mine:


    Sub Duplicates()
    Dim rng1, rng2, rng3, rng4, cell1, cell2, cell3, cell4, As Range
                
                 Set rng1 = Worksheets("Archive").Range("$B:$B")
                 Set rng2 = Worksheets("Agents").Range("J26:J1000")
                 Set rng3 = Worksheets("Archive").Range("$A:$A") 
                 Set rng4 = Worksheets("Agents").Range("E26:E1000")
    
    For Each cell1 In rng1
         If IsEmpty(cell1.Value) Then Exit For
    
    For Each cell2 In rng2
          If IsEmpty(cell2.Value) Then Exit For
    
    If cell1.Value = cell2.Value Then
           cell1.Interior.ColorIndex = 4
           cell1.Interior.Pattern = xlSolid
           cell2.Interior.ColorIndex = 4
           cell2.Interior.Pattern = xlSolid
           cell2.EntireRow.Resize(, 14).Interior.ColorIndex = 4
    End If
    
    Next cell2
    Next cell1
    
    For Each cell3 In rng3
         If IsEmpty(cell3.Value) Then Exit For
    
    For Each cell4 In rng4
           If IsEmpty(cell4.Value) Then Exit For
    
    If cell3.Value = cell4.Value Then
           cell3.Interior.ColorIndex = 5
           cell3.Interior.Pattern = xlSolid
           cell2.Font.ColorIndex = 5
           cell4.Borders.Weight = xlThick
    
    End Sub
    Thanks again for all your help!
    Last edited by adtc; 08-13-2011 at 09:32 PM. Reason: rule 3 of guidelines

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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