从另一个 sheet 中识别单击形状的名称

Identifying the name of the clicked shape from another sheet

我在 sheet 1 和 sheet 2 上工作,在两个 sheet 中都有包含代码的形状。 sheet 1 中的形状 ID 是 "RUN 1",sheet 2 中的形状 ID 是 "EQ-1"。我已经有一个代码可以识别我在 sheet1 / sheet2 上单击的形状 ID。但是代码是调试的,解释为 "the item with the specified name wasn't found"。谢谢。请帮忙 :) 此代码必须位于 sheet 2

sub x ()

'the first trial
If Sheet1.Shapes(Application.Caller).Name = "RUN 1" Then Sheet2.Cells(1, 2) = "x"
If activesheet.Shapes(Application.Caller).Name = "EQ-1" Then Sheet2.Cells(1, 2) = "x"

'the second trial
If Sheet1.Shapes(Application.Caller).Name = "RUN 1" Or _
activesheet.Shapes(Application.Caller).Name = "EQ-1" Then Sheet2.Cells(1, 2) = "x"

end sub 

尝试...

Sub x()

    If Application.Caller = "RUN 1" Or Application.Caller = "EQ-1" Then
        Sheet2.Cells(1, 2) = "x"
    End If

End Sub

希望对您有所帮助!