|
下面的三个程序是通过修改录制宏修改而来。采用Operator:=xlBetween其Formula不允许超过三个,为了将下面的六个数值的色彩设置为红色,只有把程序分三步做,请教高手,怎样用一个SUB达到目的?谢谢。
Sub Lunarday_Color0()
Columns("B:B").Select
Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlBetween, _
Formula1:="=""甲子""", Formula2:="=""甲戌"""
Selection.FormatConditions(Selection.FormatConditions.count).SetFirstPriority
With Selection.FormatConditions(1).Font
.Color = -16777024
.TintAndShade = 0
End With
Call Lunarday_Color1
End Sub
Sub Lunarday_Color1()
Columns("B:B").Select
Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlBetween, _
Formula1:="=""甲申""", Formula2:="=""甲午"""
Selection.FormatConditions(Selection.FormatConditions.count).SetFirstPriority
With Selection.FormatConditions(1).Font
.Color = -16777024
.TintAndShade = 0
End With
Call Lunarday_Color2
End Sub
Sub Lunarday_Color2()
Columns("B:B").Select
Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlBetween, _
Formula1:="=""甲辰""", Formula2:="=""甲寅"""
Selection.FormatConditions(Selection.FormatConditions.count).SetFirstPriority
With Selection.FormatConditions(1).Font
.Color = -16777024
.TintAndShade = 0
End With
Selection.FormatConditions(1).StopIfTrue = False
' ActiveWorkbook.Save
End Sub |
|