excel如何快捷找出两列名单的不同?-英雄云拓展知识分享
461
2024-01-30
Since I have had some comments and emails asking about how the new conditional formatting features could be accessed using VBA, I wanted to provide a few brief examples. One of the Excel team’s principles is that when we add new features, we make sure that they are available programmatically as well as in the user interface. The Excel 12 object model, accordingly, supports all conditional formatting functionality that is supported in the UI. This includes creating, editing, or deleting rules, or changing priorities on rules.
自从我收到一些关于“如何在VBA中使用新的条件格式”的询问,我就想提供给大家一些简单的示例。在我们Excel开发团队中有一条法则:当我们增加任何新功能时,我们必须肯定它们在被程序调用时能和在用户界面中工作的一样好。Excel 12的对象模型支持所有出现在用户界面中的条件格式功能,包括增加、编辑和s删除规则,或更改规则的优先级。
As folks who have written conditional formatting VBA in previous versions of Excel will know, the FormatConditions collection hangs off the Range object. Let me briefly run through some examples of how our new functionality is exposed in the FormatConditions collection.
在旧版本Excel中写过与条件格式相干的VBA代码的人会知道,条件格式集不能使用Range对象。让我经过运行一些简单示例来展现如何使用条件格式集中的新功能。
Creating a rule:
The new conditional formatting rules we have introduced in Excel 12 (Databars, Color Scales, Icon Sets, Top n, etc.) can be created using the Add<objectname> method in the FormatConditions collection. For example, to add a Databar, run:
Range(“A1:A5”).FormatConditions.AddDatabar
增加一个规则:
Excel 12中,新的条件格式的规则(Data bars, Color Scales, Icon Sets, Top n等待),可以在条件格式集中使用Add <对象名>的方法来创建。比如,创建一个data bar:
Range(“A1:A5”).FormatConditions.AddDatabar
Editing the rule:
To edit the rule, index into the FormatConditions collection and modify the properties. For example, to change the bar color, run:
Range(“A1:A5”).FormatConditions(1).BarColor.ColorIndex = 3
Here, the number 1 indexes the first rule on the range.
编辑现有规则:
编辑规则是经过定位条件格式集的索引号并修改其属性。比如,更改data bar的色彩:
Range(“A1:A5”).FormatConditions(1).BarColor.ColorIndex = 3
在这里,数字1表示区域中的第一个规则。
Editing the priority:
In Excel 12, we introduced the idea of rule priorities to support multiple conditions on a range. The priority determines the order of application of the rule. In the object model, we also have the Priority property on the FormatConditions object. This property is tracked at a sheet level. For example, to verify the priority of a rule, run:
?Range(“A1:A5”).FormatConditions(1).Priority
To make this rule the lowest priority:
Range(“A1:A5”).FormatConditions(1).SetLastPriority
To assign a specific priority:
Range(“A1:A5”).FormatConditions(1).Priority = 3
Note that if you had three rules, setting the priortity to be 3 and using SetLastPriority would have the same effect.
Deleting the rule:
You can delete a specific rule by indexing into it and then calling the Delete method
Range(“A1:A5”).FormatConditions(1).Delete
To delete all rules in the specific range, call the Delete method on the FormatConditions collection.
Range(“A1:A5”).FormatConditions.Delete
编辑规则优先级:
在Excel 12里,规则优先级这个概念表示支持在一个区域建立多重条件,优先级决定规则履行的次序。在对象模型里,我们一样可使用条件格式对象的优先级属性。此属性在工作表级被追踪,比如,检验某条规则的优先级:
Range(“A1:A5”).FormatConditions(1).Priority
将某规则降至最低优先级:
Range(“A1:A5”).FormatConditions(1).SetLastPriority
分配一项指定的优先级:
Range(“A1:A5”).FormatConditions(1).Priority = 3
注意,如果你只有3条规则,那末设置优先级为3和设置优先级为最低的效果是一样的。
删除规则:
你可以针对索引号并使用Delete方法来删除一个指定的规则:
Range(“A1:A5”).FormatConditions(1).Delete
也能够将Delete方法作用于条件格式集来删除指定区域中的所有规则:
Range(“A1:A5”).FormatConditions.Delete
Here’s another example. Imagine you wanted to write VBA to highlight the Top 5% of the values in the range A1-A10 with a red fill. Here is the code snippet for this:
下面是另外一个示例。假定你想用VBA来把单元格区域A1-A10中数值最高的5%突现并填充为红色,以下是相干的代码:
Sub Top5Percent()
‘Adding the Top10 rule to the range
Range(“A1:A10”).FormatConditions.AddTop10
‘Assign the rank of the condition to 5
Range(“A1:A10”).FormatConditions(1).Rank = 5
‘Set the Percent property true. It is false by default.
Range(“A1:A10”).FormatConditions(1).Percent = True
‘Set the color to a red fill
Range(“A1:A10”).FormatConditions(1).Interior.ColorIndex = 3
End Sub
Hopefully these examples are useful.
希望这些对您有所帮助。
Published Friday, October 14, 2005 1:42 PM by David Gainer
在现代企业管理中,数据的高效管理和处理至关重要。随着信息技术的不断发展,英雄云的云表单已经成为了提高数据录入、管理和分析效率的不可或缺的工具。让我们来深入探讨英雄云-云表单的几大优势。
英雄云的云表单中包括了各种基础字段,如单行文本、多行文本、数字输入框、单选框、复选框、下拉框、下拉复选框、日期时间、分割线等。这些字段的多样性使用户可以根据具体的业务需求,轻松进行文本、数据和时间信息的录入或修改。例如,您可以使用单行文本字段录入员工姓名、产品型号等,或者使用下拉框进行多选,根据不同情况选择更加方便的字段类型。
英雄云的云表单还提供了高级字段,如地址、图片、附件、手写签名、手机、子表、关联数据、关联查询以及流水号。这些高级字段在基础字段的基础上升级,可帮助用户完成一些琐碎的工作。例如,使用地址字段可以避免逐字打字,而流水号字段可以自动生成规律性的编号,非常适用于合同编号生成等场景。
英雄云的部门成员字段允许企业对各个部门的成员进行精确管理。用户可以通过部门成员字段获取通讯录中的部门成员信息,应用于记录报销人、报销部门等场景。这些成员字段还细分为成员单选和成员多选,可根据具体需求在通讯录中选择一个或多个成员。
英雄云的聚合表功能用于对已存在的表单数据进行聚合计算,从而得到一张聚合表,后续其他表单可调用聚合表进行数据联动、关联查询和关联数据等操作完成数据处理。这一功能可应用于多种场景,如进销存管理、财务管理和门店零售管理等,帮助企业完成数据处理,提高工作效率。
英雄云的表单权限设置允许用户根据企业的具体需求管理表单的访问和操作权限。用户可以根据系统权限或自定义权限对不同成员或团队进行权限设置,以确保数据的安全和合规性。这一功能使企业能够根据变化的业务需求和团队结构,实时调整权限设置。
英雄云的云表单支持自定义打印模板,可将表单数据转换为可打印的Word文档。用户可以根据自己的需求进行排版和编辑,将产品规格说明书等文档轻松生成。这一功能提供了一种标准化的文档输出方式,简化了信息整理的过程。
综合来看,选择英雄云的云表单意味着选择更智能、更灵活、更高效的数据管理工具。无论是提高工作效率,精确管理数据,还是实现数据处理,英雄云的云表单都能满足您的多样化需求,助力您的业务发展。
如果您正在寻找一款强大的云表单工具,不妨考虑英雄云,它将为您带来更多的便捷和智能,助您事半功倍。
免责声明:
本网址(www.yingxiongyun.com)发布的材料主要源于独立创作和网友匿名投稿。此处提供的所有信息仅供参考之用。我们致力于提供准确且可信的信息,但不对材料的完整性或真实性作出任何保证。用户应自行验证相关信息的正确性,并对其决策承担全部责任。对于由于信息的错误、不准确或遗漏所造成的任何损失,本网址不承担任何法律责任。本网站所展示的所有内容,如文字、图像、标志、音频、视频、软件和程序等的版权均属于原创作者。如果任何组织或个人认为网站内容可能侵犯其知识产权,或包含不准确之处,请即刻联系我们进行相应处理。
发表评论
暂时没有评论,来抢沙发吧~