【发布时间】:2019-09-12 13:41:46
【问题描述】:
我在 excel 中有超过 300.000 行的行 那我想做这份工作
- 比较列 C&D 和 E 中显示的结果
- 隐藏所有值为 TRUE 的行,只显示 FALSE
我正在尝试使用此代码,但隐藏行需要超过 15 分钟
Dim LastRow As Long
Dim i, Hide, popup As Long
LastRow = Range("B" & Rows.Count).End(xlUp).Row
For i = 1 To LastRow
If Range("C" & i).Value = Range("D" & i).Value Then
Range("E" & i).Value = "True"
Else
Range("E" & i).Value = "False"
End If
If Cells(x, "E").Value = "True" Then
Rows(x).Hidden = True
End If
Next
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
Next i
【问题讨论】:
-
在您的代码中,您不会显示
Application.Calculation = xlCalculationManual和Application.ScreenUpdating = False行。你有这些吗? -
是的,我有那个代码,但不影响这个代码
-
请注意,如果您声明
Dim i, Hide, popup As Long,则只有popup的类型为Long,而其他两个为Variant。在 VBA 中,您必须为 每个 变量声明一个类型,否则它们默认为Variant:Dim i As Long, Hide As Long, popup As Long -
尝试使用数据库(例如 sql server)来执行数据库任务(xompare mfilter)并将查询链接到工作表。(数据连接)
-
@ComputerVersteher 我知道,但我只想使用 Excel 分享这些数据