我有以下代码,称为泵压力目标寻找和测试泵压力目标寻找潜艇,这基本上只是目标寻求确定给定流量的气体流量所需的泵压力。子单独工作,当我将它们单独放入workbook_sheetchange事件时,它们也可以工作。
然而,当他们在一起如下时,我得到了一个
运行时错误' 1004':
方法'相交'对象' _Application'失败
错误在线:
If Not Application.Intersect(KeyCells, Range(Target.Address)) _
Is Nothing Then
非常感谢任何帮助。
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
Dim KeyCells As Range
Dim TestingKeyCells As Range
Set KeyCells = Worksheets("input").Range("f41")
Set TestingKeyCells = Worksheets("input").Range("y44:z45")
If Not Application.Intersect(KeyCells, Range(Target.Address)) _
Is Nothing Then
Call ThisWorkbook.Pump_Pressure_Goal_Seek
End If
If Not Application.Intersect(TestingKeyCells, Range(Target.Address)) _
Is Nothing Then
Call ThisWorkbook.Testing_Pump_Pressure_Goal_Seek
End If
End Sub