我编写了一个宏,当使用“ F8”(中断模式)运行时,它可以完美运行,但是正常运行时,该过程似乎跳过了以下步骤。相关问题的答案都无法让我解决此问题。 谁能告诉我是什么让该程序无法提供正确的结果?
Option Explicit
Dim wbTO As Workbook
Dim wsEF As Worksheet, wsTO As Worksheet
Dim r As Range
Dim x As Integer, y As Integer, rn As Integer
Dim LastColumn As Long, LastRow As Long, o As Long, oo As Long, v As Long
Sub GenerateEFiche()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Application.Calculation = xlCalculationManual
Set wbTO = ActiveWorkbook
Set wsEF = Worksheets("main")
Set wsTO = wbTO.Sheets(1)
x = Application.Match("Header1", wsTO.Rows(1), False)
y = Application.Match("Category", wsTO.Rows(1), False)
o = 0
oo = 0
v = 0
Set r = wsTO.Range(wsTO.Cells(2, x), wsTO.Cells(LastRow, x))
For Each Cell In r
rn = Cell.Row
If Cells(rn, y).Value = "ALPHA" And Not Cell = "" Then
o = o + 1
ElseIf Cells(rn, y).Value = "BRAVO" And Not Cell = "" Then
oo = oo + 1
ElseIf Cells(rn, y).Value = "CHARLIE" And Not Cell = "" Then
v = v + 1
End If
Next Cell
wsEF.Range("B25").Value = o
wsEF.Range("C25").Value = oo
wsEF.Range("D25").Value = v
Application.ScreenUpdating = True
Application.DisplayAlerts = True
Application.Calculation = xlCalculationAutomatic
Application.AskToUpdateLinks = True
MsgBox "macro terminated"
End Sub
答案 0 :(得分:1)
好的,我发现了问题:
我已经重写了代码的“针对每个”部分
com.google.cloud.storage
现在返回哪个结果。为了使公式正常工作,需要添加对单元格的正确引用。