Events Excel工作表\u更改事件不再触发
坦率地说,我不知道这是什么时候停止工作的,但不久就改用Office 2016了。无论哪种方式,以前触发的VBA事件现在都不会触发。至少它不会停在sub中可以设置断点的第一个位置 在这个项目或其他打开的项目中不使用EnableEvents,在以前触发事件、重新格式化活动单元格和其他单元格的过程中,现在它什么也不做 非常感谢您的帮助Events Excel工作表\u更改事件不再触发,events,excel-2016,Events,Excel 2016,坦率地说,我不知道这是什么时候停止工作的,但不久就改用Office 2016了。无论哪种方式,以前触发的VBA事件现在都不会触发。至少它不会停在sub中可以设置断点的第一个位置 在这个项目或其他打开的项目中不使用EnableEvents,在以前触发事件、重新格式化活动单元格和其他单元格的过程中,现在它什么也不做 非常感谢您的帮助 Public Sub Worksheet_Change(ByVal Target As Range) Const STATUSCOL1 = "L" Const STA
Public Sub Worksheet_Change(ByVal Target As Range)
Const STATUSCOL1 = "L"
Const STATUSCOL2 = "M"
Const STATUSCOL3 = "N"
Const STATUSCOL4 = "O"
Const STATUSCOL5 = "P"
Const STATUSCOL6 = "Q"
Const STATUSCOL7 = "R"
Const STATUSCOL8 = "S"
Const ACTIONCOL1 = "NOT IMPLEMENTED"
Dim Cell As Range
Dim ac As String
Dim rgtCellVal As Integer
Set Cell = Target
ac = Split(Cell.Address, "$")(1) 'For Column Letter
'if any changes at all mark colum J in Green
If Target.Cells.Count = 1 Then
'If Cell <> IIf(vOldData = vbNullString, "(Null)", vOldData) Then
If Cell.Value <> vOldData Then
Select Case ac
Case ACTIONCOL1
Cells(Cell.Row, Range("J" & 1).Column).Interior.ColorIndex = 42 'Aqua
Case Else
Cells(Cell.Row, Range("J" & 1).Column).Interior.ColorIndex = 4 'bright green
End Select
End If
End If
'Status
'---------------------------------------------------------------------------------------------------------
'Installed & Active
'I&A with Bugs
'Compromise
'If Required
'NotActivatedOrUsed
'UserBlogUseOnly
'UpdateHold
'------------------------------------------
'Deactivated
'Depricated
'Removed
'Not Installed
'------------------------------------------
'Failed
'Broken but activated
'Broken and deactivated
'------------------------------------------
'Status in question
'Ignore
'N.A.
'Not Actionable
'In Progress
'Review
'ConsiderNew
If ac = STATUSCOL1 Or ac = STATUSCOL2 Or ac = STATUSCOL3 Or ac = STATUSCOL4 Or ac = STATUSCOL5 Or ac = STATUSCOL6 Or ac = STATUSCOL7 Or ac = STATUSCOL8 Then
Select Case Cell
Case ""
Cell.Interior.ColorIndex = xlColorIndexNone 'none
Case "Installed & Active"
Cell.Interior.ColorIndex = 43 'Lime
Case "I&A with Bugs"
Cell.Interior.ColorIndex = 36 'Light Yellow
Case "Compromise"
Cell.Interior.ColorIndex = 35 'Light Green
Case "If Required"
Cell.Interior.ColorIndex = 15 'Grey - 25%
Case "UserBlogUseOnly"
Cell.Interior.ColorIndex = 15 'Grey - 25%
Case "UpdateHold"
Cell.Interior.ColorIndex = 46 'Orange
'------------------------------------------
Case "NotActivatedOrUsed"
Cell.Interior.ColorIndex = 15 'Grey - 25%
Case "Deactivated"
Cell.Interior.ColorIndex = 15 'Grey - 25%
Case "Depricated"
Cell.Interior.ColorIndex = 37 'pale blue
Case "Removed"
Cell.Interior.ColorIndex = 41 'Light blue
Case "Rejected"
Cell.Interior.ColorIndex = 41 'Light blue
Case "Not Installed"
Cell.Interior.ColorIndex = 37 'pale blue
'------------------------------------------
Case "Failed"
Cell.Interior.ColorIndex = 3 'Red
Case "Broken"
Cell.Interior.ColorIndex = 3 'Red
Case "BrokenButDeactivated"
Cell.Interior.ColorIndex = 37 'pale blue
'------------------------------------------
Case "StatusInQuestion"
Cell.Interior.ColorIndex = 44 'Gold
Case "Ignore"
Cell.Interior.ColorIndex = xlColorIndexNone 'none
Case "N.A."
Cell.Interior.ColorIndex = xlColorIndexNone 'none
Case "Not Actionable"
Cell.Interior.ColorIndex = xlColorIndexNone 'none
Case "In Progress"
Cell.Interior.ColorIndex = 15 'Grey - 25%
Case "Review"
Cell.Interior.ColorIndex = 33 'Sky Blue
Case "ConsiderAlt"
Cell.Interior.ColorIndex = 44 'Gold
Case "------------------------------------------"
Cell.Interior.ColorIndex = xlColorIndexNone 'none
Case Else
Cell.Interior.ColorIndex = 40 'Tan
rgtCellVal = Cell.Offset(0, 1).Interior.ColorIndex
If (Cell = "") And rgtCellVal = 15 Then
Cell.Interior.ColorIndex = 15
End If
End Select
End If
End Sub
Public子工作表\u更改(ByVal目标作为范围)
Const STATUSCOL1=“L”
Const STATUSCOL2=“M”
Const STATUSCOL3=“N”
Const STATUSCOL4=“O”
Const STATUSCOL5=“P”
Const STATUSCOL6=“Q”
Const STATUSCOL7=“R”
Const STATUSCOL8=“S”
Const ACTIONCOL1=“未实现”
暗淡单元格作为范围
将ac调暗为字符串
Dim rgtCellVal为整数
设置单元格=目标
ac=列字母的拆分(Cell.Address,“$”(1)”
'如果有任何变化,用绿色标记柱J
如果Target.Cells.Count=1,则
'如果单元格IIf(vOldData=vbNullString,“(Null)”,vOldData),则
如果Cell.Value vOldData那么
选择案例ac
案例行动1
单元格(Cell.Row,Range(“J”&1.Column).Interior.ColorIndex=42'浅绿色
其他情况
单元格(Cell.Row,Range(“J”&1.Column).Interior.ColorIndex=4'亮绿色
结束选择
如果结束
如果结束
"地位",
'---------------------------------------------------------------------------------------------------------
'已安装并处于活动状态
“有虫子的I&A
"妥协",
“如果需要
“没有激活或使用
'UserBlogUseOnly
“更新霍尔德
'------------------------------------------
"停用",
“去润滑
“删除
“未安装
'------------------------------------------
"失败了!
"破,动"
"断断续续,
'------------------------------------------
"地位问题",
"不理!
”“不。
"不可诉",
“进行中
"回顾",
“考虑新的
如果ac=STATUSCOL1或ac=STATUSCOL2或ac=STATUSCOL3或ac=STATUSCOL4或ac=STATUSCOL5或ac=STATUSCOL6或ac=STATUSCOL7或ac=STATUSCOL8,则
选择案例单元
案例“”
Cell.Interior.ColorIndex=xlColorIndexNone'无
案例“已安装并处于活动状态”
Cell.Interior.ColorIndex=43'石灰
案例“有缺陷的I&A”
Cell.Interior.ColorIndex=36'浅黄色
案例“妥协”
Cell.Interior.ColorIndex=35'浅绿色
案例“如果需要”
Cell.Interior.ColorIndex=15'灰色-25%
案例“UserBlogUseOnly”
Cell.Interior.ColorIndex=15'灰色-25%
案例“UpdateHold”
Cell.Interior.ColorIndex=46'橙色
'------------------------------------------
案例“未激活或使用”
Cell.Interior.ColorIndex=15'灰色-25%
案例“停用”
Cell.Interior.ColorIndex=15'灰色-25%
“去润滑”案例
Cell.Interior.ColorIndex=37'浅蓝色
“删除”案例
Cell.Interior.ColorIndex=41'浅蓝色
案件“驳回”
Cell.Interior.ColorIndex=41'浅蓝色
案例“未安装”
Cell.Interior.ColorIndex=37'浅蓝色
'------------------------------------------
案例“失败”
Cell.Interior.ColorIndex=3'红色
案例“破碎”
Cell.Interior.ColorIndex=3'红色
“断头台”案
Cell.Interior.ColorIndex=37'浅蓝色
'------------------------------------------
“问题中的状态”一案
Cell.Interior.ColorIndex=44'黄金
案例“忽略”
Cell.Interior.ColorIndex=xlColorIndexNone'无
案例“不适用”
Cell.Interior.ColorIndex=xlColorIndexNone'无
案例“不可起诉”
Cell.Interior.ColorIndex=xlColorIndexNone'无
案件“进行中”
Cell.Interior.ColorIndex=15'灰色-25%
案例“审查”
Cell.Interior.ColorIndex=33'天蓝色
案例“考虑”
Cell.Interior.ColorIndex=44'黄金
案例“--------------------------------------”
Cell.Interior.ColorIndex=xlColorIndexNone'无
其他情况
Cell.Interior.ColorIndex=40'棕褐色
rgtCellVal=Cell.Offset(0,1).Interior.ColorIndex
如果(Cell=”“)和rgtCellVal=15,则
Cell.Interior.ColorIndex=15
如果结束
结束选择
如果结束
端接头
我还没有Excel 2016,但在2007-2013年,您可以在
文件-->
选项-->
信任中心-->
信任中心设置…
宏设置
确保选择了“禁用带有通知的所有宏”或“禁用更好的宏”
如果它是一个外接程序,我会说检查禁用的外接程序,但它看起来不像一个
文件在哪里?如果它在网络驱动器上,当您将其复制到本地驱动器时,它是否工作?如果是这样,请检查信任中心设置下的受信任文档选项…确定我有答案: 信托中心。宏设置选项卡。开发人员宏设置部分。信任对VBA项目对象模型的访问。勾选是 我不想成为“那些”家伙中的一员,但为什么不使用条件格式呢?有VB代码运行吗?宏或工作簿被禁用了吗?它可能被禁用