Results 1 to 4 of 4

Macro for highlighting dates in red and orange

Threaded View

  1. #1
    Registered User
    Join Date
    03-28-2010
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2007
    Posts
    38

    Macro for highlighting dates in red and orange

    Hi,

    Can someone please help me edit an existing macro? Need 3 changes –

    1) The macro creates a new workbook and also copies the hidden rows from the original file. I don’t need the hidden rows on the new workbook
    2) On the new workbook sheet1, sheet2 & sheet3 are blank and need to be deleted.
    3) On the new workbook “decision date” column any date before today’s date should be highlighted in red and anything = > today’s date should be highlighted in orange

    Hope someone can help me out with this please!!!

    Have attached sample data and vba code pasted below –


    Option Explicit
    
    Dim FName As String
    Dim SName As String
    Dim lrow As Long
    Dim i As Long
    
    Sub filter_rows()
    
    Application.DisplayAlerts = False
    Application.ScreenUpdating = False
    
    Workbooks.Add
    ActiveWorkbook.SaveAs ("Output File")
    FName = ActiveWorkbook.Name
    
    With ThisWorkbook.Worksheets("Pipeline (Current wk)")
        lrow = .Range("A" & .Rows.Count).End(xlUp).Row
        For i = 15 To lrow
            If .Range("U" & i).Value <= Date + 7 Then
                SName = .Range("X" & i).Value
                If Not Evaluate("ISREF('" & SName & "'!A1)") Then
                    Workbooks(FName).Worksheets.Add(After:=Worksheets(Worksheets.Count)).Name = SName
                    .Rows("14:14").Copy Workbooks(FName).Worksheets(SName).Range("A1")
                End If
                .Rows(i & ":" & i).Copy Workbooks(FName).Worksheets(SName).Range("A" & Rows.Count).End(xlUp).Offset(1, 0)
            End If
        Next i
    End With
    
    With Workbooks(FName)
        
    End With
    
    Application.DisplayAlerts = True
    Application.ScreenUpdating = True
    
    End Sub
    Attached Files Attached Files
    Last edited by Cutter; 07-18-2012 at 01:17 PM. Reason: Added code tags

Thread Information

Users Browsing this Thread

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

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