Hi,

I normally use Option Explicit at the begining of all my code, but found one instance that is troubling me. Part of a macro performes conditional formatting. Depending on the version of Excel you have, I have set up two scenarios: one for XL 2010 and one for XL 2007. The problem is that it will not compile in a machine that runs XL 2007 if I have Option Explicit added to the top of my code because it doesn't recognize the variables that MS introduced with the newer version of XL. I tried declaring them as variants but to no avail.

Any thought?

' Add conditional formatting for Column F (Excel 2010 only)
    If Application.Version = 14# Then
        With Columns("F:F")
            .FormatConditions.AddDatabar
            .FormatConditions(Columns("F:F").FormatConditions.Count).ShowValue = False
            .FormatConditions(Columns("F:F").FormatConditions.Count).SetFirstPriority
            With .FormatConditions(1)
                .MinPoint.Modify newtype:=xlConditionValueAutomaticMin
                .MaxPoint.Modify newtype:=xlConditionValueAutomaticMax
                .BarColor.Color = 8700771
                .BarFillType = xlDataBarFillGradient
                .Direction = xlContext
                .NegativeBarFormat.ColorType = xlDataBarColor
                .BarBorder.Type = xlDataBarBorderSolid
                .NegativeBarFormat.BorderColorType = xlDataBarColor
                .BarBorder.Color.Color = 8700771
                .AxisPosition = xlDataBarAxisAutomatic
                .AxisColor.Color = 0
                .NegativeBarFormat.Color.Color = 255
                .NegativeBarFormat.BorderColor.Color = 255
            End With
        End With
    Else
        With Columns("F:F")
            .FormatConditions.AddDatabar
            .FormatConditions(Selection.FormatConditions.Count).ShowValue = False
            .FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
            With .FormatConditions(1)
                .MinPoint.Modify newtype:=xlConditionValueLowestValue
                .MaxPoint.Modify newtype:=xlConditionValueHighestValue
            End With
            With .FormatConditions(1).BarColor
                .Color = 5920255
            End With
        End With
    End If
abousetta