`
piecehealth
  • 浏览: 47925 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

Excel VBA FormatConditions.Add 公式不对的解决。

 
阅读更多
此文献给正在被FormatConditions.Add这个方法折磨的人。
当你发现你Add后,实际的公式值与你的Formula1的值不一样的时候,请在此之前加一句Range.Select

Range.Select
Range.FormatConditions.Add ...

可参考http://topic.csdn.net/u/20120610/01/f78c93f2-af45-4985-a5f9-c925be1d05ce.html?seed=1430368056&r=78851359#r_78851359

希望面临此问题的同学能百度的我的帖子,不用像我一样足足瞎琢磨了了好几小时。
分享到:
评论

相关推荐

    Excel VBA Range对象等基本操作应用示例

    5. 条件格式化:`With Range("A1:A10") .FormatConditions.Add Type:=xlCellValue, Operator:=xlLess, Formula1:="10" .FormatConditions(1).SetFirstPriority .Font.ColorIndex = 3 .StopIfTrue = False End With` ...

    Excel-VBA宏编程实例源代码-单元格的选取与显示-商品成本与利润.zip

    .FormatConditions.Add Type:=xlExpression, Formula1:="=$D2如果利润为负,则应用条件 With .FormatConditions(1) .SetFirstPriority .Font.Color = RGB(255, 0, 0) ' 设置字体颜色为红色 End With End With `...

    Excel-VBA宏编程实例源代码-工作表的操作-公司财务报表3.zip

    .FormatConditions.Add Type:=xlCellValue, Operator:=xlGreater, Formula1:="10" .FormatConditions(1).SetFirstPriority With .FormatConditions(1).Font .ColorIndex = xlAutomatic .TintAndShade = -0....

    EXCEL行变各种颜色代码

    2. **Cells.FormatConditions.Delete**:删除之前的所有条件格式设置,以避免冲突。 3. **With...EntireRow...FormatConditions**:针对选中单元格所在的整行进行操作。 4. **.Add xlExpression, , "TRUE"**:添加一...

    Excel-VBA宏编程实例源代码-排序与查询-添加单元格条件格式.zip

    - `New Formatting Rule`涉及到`FormatConditions.Add`方法,选择条件类型(如颜色刻度、图标集或数据条),并设置相应的条件和格式。 5. **实践应用**: - 这个压缩包可能包含若干个Excel文件,每个文件中都有VBA...

    经典VBA代码

    - `ActiveSheet.UsedRange.FormatConditions.Delete`: 删除当前工作表上的所有条件格式规则。 - `Cells.Hyperlinks.Delete`: 删除选定单元格中的超链接。 6. **页面设置与打印预览** - `ActiveSheet.PageSetup....

    有关excel电子表格中IF函数的问题.doc

    Range("A1:A10").FormatConditions.Add Type:=xlCellValue, Operator:=xlGreater, Formula1:="=8" Range("A1:A10").FormatConditions(1).Font.ColorIndex = 3 End Sub 这个代码使用 VBA 宏来实现自动填充颜色的...

Global site tag (gtag.js) - Google Analytics