简体   繁体   English

选择并双击特定单元格后,Excel公式无法在运行时执行

[英]Excel formula not executing on run time with selecting and double click on the particular cell

My scenario is , I have one Excel sheet. 我的情况是,我只有一张Excel工作表。 On the same sheet in cell A2 I am inserting the data through code and cell B2 I already put the data manually before inserting the data in cell A2, in cell C2 I written the formula =EXACT(A2,B2). 在单元格A2中的同一张纸上,我正在通过代码插入数据,单元格B2中,我已经在将数据插入单元格A2中之前手动放置了数据,在单元格C2中,我写了公式= EXACT(A2,B2)。

Now when I run the code, the code put the value in cell A2,and the Status should be change according to the condition given and the data on both cells. 现在,当我运行代码时,代码将值放在单元格A2中,并且状态应根据给定的条件和两个单元格上的数据进行更改。 But it doesn't change the status according to the formula in cell C2 and the status gets changed when I double click on that particular cell and enter then the condition work. 但是,它不会根据单元格C2中的公式更改状态,并且当我双击该特定单元格并输入条件后,状态就会更改。 Please tell me how it will be possible without double click on the particular cell? 请告诉我,不用双击特定单元格怎么可能?

This works (I've tested it) if automatic calculation is switched on (Excel Options->Formulas->Calculation Options). 如果启用了自动计算 (Excel选项->公式->计算选项), 可以使用(我已经测试过)。

Here's the code (I'm using A1, B1, C1): 这是代码(我正在使用A1,B1,C1):

Private Sub CommandButton1_Click()
  Cells(1, 1).Value = 2
End Sub

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM