注册 登录
编程论坛 VFP论坛

Excel 单元格增加 条件格式 的代码怎么写

easyppt 发布于 2022-09-02 11:49, 1064 次点击
VBA录制的代码如下,怎么转换为 VFP:
*    Range("N2").Select
*    Selection.FormatConditions.Add Type:=xlExpression, Formula1:="=$N$2<>0"
*    Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
*    With Selection.FormatConditions(1).Interior
*        .PatternColorIndex = xlAutomatic
*        .Color = 10498160
*        .TintAndShade = 0
*    End With
*    Selection.FormatConditions(1).StopIfTrue = False
3 回复
#2
easyppt2022-09-02 13:16
自己摸索出来了:
with .Range("N2")
    .FormatConditions.Add(2, 5, "=$N$2<>0")
    .FormatConditions(1).Interior.ColorIndex = 6
endwith
#3
laowan0012022-09-02 14:28
#4
schtg2022-09-03 06:01
1