Results 1 to 2 of 2

Vba conditional formatting macro partial running

Threaded View

OzNoz Vba conditional formatting... 06-16-2011, 03:37 AM
OzNoz Re: Vba conditional... 06-20-2011, 03:17 AM
  1. #1
    Registered User
    Join Date
    06-16-2011
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    2

    Vba conditional formatting macro partial running

    Hi I am trying to create a spreadsheet with many variables, and want them all to conditionally format when they auto-populate various other worksheets. The auto-formatting will vary from sheet to sheet dependant on primary user preferences, but the template will be the same for all. I am having issues with the template though, as I can only get the first 3 commands to run on it? Can anyone out there fix it as I am a total newb on VBA, and have taught myself everything I know on it in the last 2 days...

    Any help would be much appreiciated,

    Cheers,

    oli

    Here is the macro:

    Sub Macro1()
    '
    ' Macro1 Macro
    ' Macro recorded 09/06/2011 by SMITHSO
    '
    
    '
        Selection.FormatConditions.Delete
        Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlBetween, _
            Formula1:="=""A00""", Formula2:="=""A99"""
        With Selection.FormatConditions(1).Font
            .Bold = True
            .Italic = False
            .ColorIndex = 2
        End With
        Selection.FormatConditions(1).Interior.ColorIndex = 45
        Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlBetween, _
            Formula1:="=""B00""", Formula2:="=""B99"""
        With Selection.FormatConditions(2).Font
            .Bold = True
            .Italic = False
            .ColorIndex = 2
        End With
        Selection.FormatConditions(2).Interior.ColorIndex = 13
        Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlEqual, _
            Formula1:="=""FIELD1"""
        With Selection.FormatConditions(3).Font
            .Bold = True
            .Italic = False
            .ColorIndex = 2
        End With
        Selection.FormatConditions(3).Interior.ColorIndex = 12
        Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlEqual, _
            Formula1:="=""FIELD2"""
        With Selection.FormatConditions(4).Font
            .Bold = True
            .Italic = False
            .ColorIndex = 2
        End With
        Selection.FormatConditions(4).Interior.ColorIndex = 5
        Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlEqual, _
            Formula1:="=""FIELD3"""
        With Selection.FormatConditions(5).Font
            .Bold = True
            .Italic = False
            .ColorIndex = xlAutomatic
        End With
        Selection.FormatConditions(5).Interior.ColorIndex = 37
        Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlEqual, _
            Formula1:="=""FIELD4"""
        With Selection.FormatConditions(6).Font
            .Bold = True
            .Italic = False
            .ColorIndex = 6
        End With
        Selection.FormatConditions(6).Interior.ColorIndex = 41
        Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlEqual, _
            Formula1:="=""FIELD5"""
        With Selection.FormatConditions(7).Font
            .Bold = True
            .Italic = False
            .ColorIndex = 10
        End With
        Selection.FormatConditions(7).Interior.ColorIndex = 3
        Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlEqual, _
            Formula1:="=""FIELD6"""
        With Selection.FormatConditions(8).Font
            .Bold = True
            .Italic = False
            .ColorIndex = 2
        End With
        Selection.FormatConditions(8).Interior.ColorIndex = 1
        Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlEqual, _
            Formula1:="=""FIELD7"""
        With Selection.FormatConditions(9).Font
            .Bold = True
            .Italic = False
            .ColorIndex = 3
        End With
        Selection.FormatConditions(9).Interior.ColorIndex = 35
        Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlEqual, _
            Formula1:="=""FIELD8"""
        With Selection.FormatConditions(10).Font
            .Bold = True
            .Italic = False
            .ColorIndex = 2
        End With
        Selection.FormatConditions(10).Interior.ColorIndex = 3
        Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlEqual, _
            Formula1:="=""FIELD9"""
        With Selection.FormatConditions(11).Font
            .Bold = True
            .Italic = False
            .ColorIndex = 2
        End With
        Selection.FormatConditions(11).Interior.ColorIndex = 7
        Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlEqual, _
            Formula1:="=""FIELD10"""
        With Selection.FormatConditions(12).Font
            .Bold = True
            .Italic = False
            .ColorIndex = xlAutomatic
        End With
        Selection.FormatConditions(12).Interior.ColorIndex = 38
        Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlEqual, _
            Formula1:="=""FIELD11"""
        With Selection.FormatConditions(13).Font
            .Bold = True
            .Italic = False
            .ColorIndex = 4
        End With
        Selection.FormatConditions(13).Interior.ColorIndex = 1
    End Sub
    Last edited by OzNoz; 06-16-2011 at 04:50 AM.

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