Results 1 to 10 of 20

Thread: Conditional Formatting of Dates (Multiple Criteria)

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #12
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    10,457
    Rep Power
    10
    Hi …
    Blank row problem ….
    This problem is because

    _ I use all UsedRange … This includes
    empty column A and empty column L
    If column L = “”
    If arrL(Cnt, 1) = “” __ is True

    If column A = “”
    If ____ (Nah - arrA(Cnt, 1)) >= 150 __ is True

    So
    If arrL(Cnt, 1) = "" And (Nah - arrA(Cnt, 1)) >= 150
    is __ = True __ and __ True
    So Then Interior Color is made to be vbYellow
    This is the problem. You do not want that…

    How about,
    If column A is “” then Do Nothing
    Code:
    Option Explicit
    Sub ChkChqe()
    Dim Ws1 As Worksheet
     Set Ws1 = ThisWorkbook.Worksheets.Item(1)
    Dim rngA As Range: Set rngA = Ws1.Range("A1:A" & Ws1.UsedRange.Rows.Count & "")
    Dim rngL As Range: Set rngL = Ws1.Range("L1:L" & Ws1.UsedRange.Rows.Count & "")
    Dim arrA() As Variant, arrL() As Variant
     Let arrA() = rngA.Value2: Let arrL() = rngL.Value2
    Dim Nah As Long: Let Nah = Now
    Dim Cnt As Long
        For Cnt = 3 To Ws1.UsedRange.Rows.Count
            If arrA(Cnt, 1) = "" Then
            ' Do nothing
            Else
              If arrL(Cnt, 1) = "" And (Nah - arrA(Cnt, 1)) >= 150 Then rngA.Item(Cnt).Interior.Color = vbYellow
            End If
        Next Cnt
    End Sub
    Now I think all is OK

    Before:
    _____ Workbook: Cheque Book Register 11Feb.xls ( Using Excel 2007 32 bit )
    Row\Col
    A
    B
    C
    D
    E
    F
    G
    H
    I
    J
    K
    L
    M
    74
    10.02.2019
    072499
    19,500.00
    Not Entered
    75
    10.02.2019
    072500
    Not Entered
    76
    01.01.2019
    072501
    2,000.00
    01.01.2019
    Cleared
    01.01.2019
    Not Entered
    77
    10.02.2019
    072502
    2,000.00
    10.02.2019
    Cleared
    10.02.2019
    Not Entered
    78
    10.09.2018
    2,000.00
    10.09.2018
    Cleared
    15.09.2018
    Not Entered
    79
    10.09.2018
    2,000.00
    31.12.2018
    Not Entered
    80
    Not Entered
    Worksheet: Cheques

    After running routine, Sub ChkChqe()
    _____ Workbook: Cheque Book Register 11Feb.xls ( Using Excel 2007 32 bit )
    Row\Col
    A
    B
    C
    D
    E
    F
    G
    H
    I
    J
    K
    L
    M
    75
    10.02.2019
    072500
    Not Entered
    76
    01.01.2019
    072501
    2,000.00
    01.01.2019
    Cleared
    01.01.2019
    Not Entered
    77
    10.02.2019
    072502
    2,000.00
    10.02.2019
    Cleared
    10.02.2019
    Not Entered
    78
    10.09.2018
    2,000.00
    10.09.2018
    Cleared
    15.09.2018
    Not Entered
    79
    10.09.2018
    2,000.00
    31.12.2018
    Not Entered
    80
    Not Entered
    Worksheet: Cheques

    Alan
    Attached Files Attached Files
    ….If you are my competitor, I will try all I can to beat you. But if I do, I will not belittle you. I will Salute you, because without you, I am nothing.
    If you are my enemy, we will try to kick the fucking shit out of you…..
    Winston Churchill, 1939
    Save your Forum..._
    KILL A MODERATOR!!

Similar Threads

  1. testing BBCode with conditional formatting
    By Admin in forum Test Area
    Replies: 0
    Last Post: 01-20-2016, 08:36 AM
  2. get conditional formatting color of a cell
    By SP69 in forum Excel Help
    Replies: 2
    Last Post: 09-30-2013, 03:08 PM
  3. Conditional formatting
    By mahmoud-lee in forum Excel Help
    Replies: 9
    Last Post: 05-30-2013, 03:00 PM
  4. Conditional Formatting using formula.
    By Ryan_Bernal in forum Excel Help
    Replies: 2
    Last Post: 02-18-2013, 11:33 PM
  5. Conditional Formatting - If/And Formula
    By Katrina in forum Excel Help
    Replies: 4
    Last Post: 11-23-2012, 12:45 AM

Tags for this Thread

Posting Permissions

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