+ Reply to Thread
Results 1 to 3 of 3

Conditional Format entire row

Hybrid View

  1. #1
    Registered User
    Join Date
    09-20-2011
    Location
    Belfast
    MS-Off Ver
    Excel 2007
    Posts
    34

    Conditional Format entire row

    I have the following code to highlight cells within a user defined date range. At present it highlights any cell that meets the criteria. I would like it to highlight the entire row. Does anyone know how to do this?

    Sub Auto_Open()
    '
    '
    Dim MyInput As String
    Dim MyInput2 As String
    
    MyInput = InputBox("Enter Start of Date Range dd/mm/yyyy", "Start Date")
    MyInput2 = InputBox("Enter End of Date Range dd/mm/yyyy", "End Date")
    
    Cells.Select
        Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlBetween, _
            Formula1:=MyInput, Formula2:=MyInput2
        Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
        With Selection.FormatConditions(1).Interior
            .PatternColorIndex = xlAutomatic
            .ThemeColor = xlThemeColorAccent2
            .TintAndShade = 0.599963377788629
        End With
        Selection.FormatConditions(1).StopIfTrue = False
        Range("A1").Select
    End Sub

  2. #2
    Valued Forum Contributor
    Join Date
    06-17-2009
    Location
    Chennai,India
    MS-Off Ver
    Excel 2003,excel 2007
    Posts
    678

    Re: Conditional Format entire row

    why not this macro perhaps simpler CHANGE THE COLOR NUMBER IF YOU WANT


    Sub test()
    Dim MyInput
    Dim MyInput2
    Dim cfind1 As Range, cfind2 As Range
    MyInput = InputBox("Enter Start of Date Range dd/mm/yyyy", "Start Date")
    MyInput2 = InputBox("Enter End of Date Range dd/mm/yyyy", "End Date")
    Set cfind1 = Cells.Find(what:=CDate(MyInput), lookat:=xlWhole)
    Set cfind2 = Cells.Find(what:=CDate(MyInput2), lookat:=xlWhole)
    Range(cfind1, cfind2).EntireRow.Interior.ColorIndex = 3
    End Sub
    I am not an expert. better solutions may be available
    $$$$venkat1926$$$$@gmail.com

  3. #3
    Registered User
    Join Date
    09-20-2011
    Location
    Belfast
    MS-Off Ver
    Excel 2007
    Posts
    34

    Re: Conditional Format entire row

    Thanks venkat1926,

    When I try that I get an error masseage saying "Method 'Range' of object '_Global' failed" any idea why that might be?

    Thanks,

    Dean

+ 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