本文转自:https://msdn.microsoft.com/en-us/library/office/ff839775.aspx#AboutContributor

Example

 

The following code example changes the color of changed cells to blue.

Private Sub Worksheet_Change(ByVal Target as Range)
Target.Font.ColorIndex = 5
End Sub

Sample code provided by: Bill Jelen, MrExcel.com | About the Contributors

The following code example verifies that, when a cell value changes, the changed cell is in column A, and if the changed value of the cell is greater than 100. If the value is greater than 100, the adjacent cell in column B is changed to the color red.

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Target.Column = 1 Then
ThisRow = Target.Row
If Target.Value > 100 Then
Range("B" & ThisRow).Interior.ColorIndex = 3
Else
Range("B" & ThisRow).Interior.ColorIndex = xlColorIndexNone
End If
End If
End Sub

Sample code provided by: Tom Urtis, Atlas Programming Management | About the Contributors

The following code example sets the values in the range A1:A10 to be uppercase as the data is entered into the cell.

Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("A1:A10")) Is Nothing Or Target.Cells.Count > 1 Then Exit Sub
Application.EnableEvents = False
'Set the values to be uppercase
Target.Value = UCase(Target.Value)
Application.EnableEvents = True
End Sub

[转]Worksheet.Change Event (Excel)的更多相关文章

  1. there is issue about change event of checkbox in the ie8 oe ie7

    some people said the change event of checkbox can not trigger in the ie7 or ie8,that's not true. thi ...

  2. JPA project Change Event Handler问题解决[转]

    转至:http://my.oschina.net/cimu/blog/278724 这是Eclipse中的一个GUG: Bug 386171 - JPA Java Change Event Handl ...

  3. 【转】JPA project Change Event Handler / 导致eclipse十分卡

    这是Eclipse中的一个GUG: Bug 386171 - JPA Java Change Event Handler (Waiting) 解决方法: 1.) 退出Myeclipse(或eclips ...

  4. JPA project Change Event Handler问题解决

    eclipse使用的是有经常会出现JPA project Change Event Handler(watering)很卡 网上的解决办法是 [Help > Installation Detai ...

  5. js & input event & input change event

    js & input event & input change event vue & search & input change <input @click=& ...

  6. VSTO:使用C#开发Excel、Word【12】

    Excel对象模型中的事件了解excel对象模型中的事件至关重要,因为这通常是代码运行的主要方式.本章将检查Excel对象模型中的所有事件,引发事件以及可能与这些事件关联的代码类型. Excel对象模 ...

  7. C# worksheet设置Excel样式

    1.例子导出Excel的样式 样式代码 public void Exportdatagridviewtoexcel(string Textname) { SaveFileDialog savedial ...

  8. C# worksheet设置Excel样式(转载)

    1.例子导出Excel的样式public void Exportdatagridviewtoexcel(string Textname) { SaveFileDialog savedialog = n ...

  9. 如何使用 Visual C# .NET 处理 Excel 事件

    事件处理概述 Visual C# .NET 使用委派处理来自组件对象模型 (COM) 服务器的事件.委派是 Microsoft Visual Studio .NET 中的一个新概念.对于 COM 事件 ...

随机推荐

  1. sencha grid列tooltip提示

    grid的某一列添加renderer: renderer: function(value, metaData, record, rowIndex, colIndex, store, view) { m ...

  2. 怎样用C#代码知道是否已连接网络

    有时,上传数据和下载数据都需要用到网络,但是不知道程序是否已连接到网络,下面是简单测试是否已连接网络的小功能 1.在winform窗体上添加一个按钮和多选框

  3. 重新想象 Windows 8 Store Apps (52) - 绑定: 与 Element Model Indexer Style RelativeSource 绑定, 以及绑定中的数据转换

    [源码下载] 重新想象 Windows 8 Store Apps (52) - 绑定: 与 Element Model Indexer Style RelativeSource 绑定, 以及绑定中的数 ...

  4. Studio for Winforms FlexGrid: 创建分类汇总

    C1FlexGrid.Subtotal方法可以增加包含普通(非小计)行的汇总数据的分类汇总行. 分类汇总支持分层聚合.例如,如果你的表格包含销售数据,你可能会通过产品.地区和推销员来小计一下以得出总的 ...

  5. CentOS7.2设置zabbix

    准备工作 1.lnmp或lamp环境,本机环境:CentOS 7.2 64位,nginx1.10.2 php5.6.26 mysql5.7.15 2.软件Zabbix wget http://nchc ...

  6. sqlite3之基本操作(二)

    作者:Vamei 出处:http://www.cnblogs.com/vamei 欢迎转载,也请保留这段声明.谢谢! Python自带一个轻量级的关系型数据库SQLite.这一数据库使用SQL语言.S ...

  7. Introduction to ASP.NET 5

    ASP.NET 5 is a significant redesign of ASP.NET. This topic introduces the new concepts in ASP.NET 5 ...

  8. CSS基础选择器温故-1

    1.基本选择器语法 2.浏览器兼容性:浏览器对基本选择器都是一路绿灯通行,可以放心使用. 3.通配选择器:选择所有元素,也可以选择某个元素下的所有元素 (1)选择所有元素: *{margin: 0;p ...

  9. 桥牌笔记:Skill 4 Series A–Deal 5

    南主打5C. 此牌的难点在于:如果黑桃4-2分布时,有没有打成的希望?看来黑桃.红桃.方块各1个失张无法避免? 但希望还是有的,那就是东家拿2张黑桃,并且有3张将牌. 这时庄家可以清2轮将牌,拔2轮黑 ...

  10. 【转】android shape的使用

    shape用于设定形状,可以在selector,layout等里面使用,有6个子标签,各属性如下: <?xml version="1.0" encoding="ut ...