我试图计算每张单张格子A1 =" next"然后将该数字存储为变量。然后将当前工作表上的单元格A2设置为等于该变量。这就是我所拥有的:
private void btnExponentActionPerformed(java.awt.event.ActionEvent evt) {
firstnum = Double.parseDouble(tfdDisplay.getText());
tfdDisplay.setText(null);
operations = "^";
}
我在这里错过了什么?
答案 0 :(得分:2)
您需要告诉vba哪个工作表范围(“A1”)属于:
If ws.range("A1").value = "next" Then
所以:
Dim ws As Worksheet
Dim i As Long
i = 0
For Each ws In ActiveWorkbook.Worksheets
If ws.range("A1").value = "next"
i = i + 1
End If
Activesheet.Range("A2").Value = i
Next ws