我的 Excel 项目在家中正常运行(使用Excel 2010),但不能在两台工作计算机(使用Excel 2016)上正常运行,我怀疑Worksheet_Change事件是问题所在。
当用户进行更改时,黄色条(在屏幕截图中)应该再次变为白色,但事实并非如此。我在 2 台工作计算机上收到 2 种不同的响应。
代码中有两点需要指出:
在某些地方我使用vbColor扩展名,而在其他地方我必须使用数字代码。
一台计算机根本没有触发Worksheet_Change事件。我会注意到更改事件位于代码的顶部,尽管这与它无关。
我很感激建议和详细的解释,以帮助我学习。
Private Sub Worksheet_Change(ByVal Target As Range) 'Check for On-Time and Delays then change the Command Button Colors to show completed.
'Return headers to white after jump to
Range("B3:I3,O3:V3,B28:I28,O28:V28,B53:I53,O53:V53,B78:I78,O78:V78,B103:I103,O103:V103,B128:I128,O128:V128,B153:I153,O153:V153").Interior.Color = vbWhite
'Check for On Time and Delayed Trips
'Trip 1 Scan Ready
If IsEmpty(Range("L3").Value) = False Then
If Range("L3").Value > Range("I3").Value Then 'If actual is greater than …Run Code Online (Sandbox Code Playgroud)