locked
Need Macro for this RRS feed

  • Question

  • Data validation is there on Column "C" Else id I select:--

    Status = ‘NS’ -> Date should not be less than today + 14 days (GREEN else RED)

    Status = ‘NR’ -> No date (GREEN else RED)

    Status = ‘P’ -> Date should be of today OR for future (GREEN else RED)

    Status = ‘F’ OR ‘C’ -> Date should be today OR in past (GREEN else RED

    LAN   Services Cutover Start LAN Services   Cutover End LAN Services Cutover Status
        NS
        NS
        NS
    01/07/16 21/07/16 NR
    01/07/16 21/07/16 NS
    01/07/16 21/07/16 NS
    01/07/16 21/07/16 NS
    01/07/16 21/07/16 NS
    01/07/16 21/07/16 NS
    01/07/16 21/07/16 P
    01/07/16 21/07/16 F
    01/07/16 21/07/16 NS
    01/07/16 21/07/16 NS
    01/07/16 21/07/16 NS

    Monday, June 13, 2016 8:46 AM

Answers

  • >>>I need macro for this..

    According to your description, you could modify below code based on your real requirement:

    Sub Demo()
    
         Set Rng = ActiveSheet.Range("C1:C3")
         For Each cell In Rng
    
           Select Case cell.Value
              Case "Ns":
                Debug.Print cell.Offset(, -1)
                If cell.Offset(0, -1) > 100 Then
                   cell.Offset(0, -1).Interior.ColorIndex = 46
                Else
                   cell.Offset(0, -1).Interior.ColorIndex = 10
                End If
           End Select
           
         Next cell
        
    End Sub

    The result:

    • Marked as answer by David_JunFeng Wednesday, June 22, 2016 9:34 AM
    Wednesday, June 15, 2016 6:44 AM

All replies