excel - 执行 If 语句的更快方法
问题描述
有没有更快的方法来运行下面的代码?“hr”表有 24000 行,运行这个简单的查询大约需要 30 多分钟。
Sub populateHRData17()
'APAC
Set report = ActiveWorkbook.Worksheets("Report")
Set hr = ActiveWorkbook.Worksheets("HR_Report")
Set apac = ActiveWorkbook.Worksheets("APAC_L_R")
For x = 2 To report.UsedRange.Rows.Count
If report.Cells(x, 1) = "" Then
End If
Next x
For i = 2 To hr.UsedRange.Rows.Count
For j = 2 To apac.UsedRange.Rows.Count
If apac.Cells(j, 2) = hr.Cells(i, 3) Then
report.Cells(x, 1) = apac.Cells(j, 2)
x = x + 1
End If
Next j
Next i
End Sub
解决方案
推荐阅读
- webots - 使用扭矩模式进行车辆控制的问题
- technical-indicator - 如何将 Windows 10 PC 变成 SMTP 服务器?
- javascript - 函数不会像我想象的那样改变 var
- php - 登录时查看 /Fetch 记录的用户数据 - CodeIgniter
- sql - SQL 连接应该只显示一行
- linkedin - 如何通过linkedin获取accessToken
- sql - 如何识别非模式绑定依赖项
- php - PHP filemtime 返回空
- c++ - 要在屏幕上绘制一些小图块,我应该使用 QQuickItem 还是 QQuickPaintedItem?
- r - 如何在 R 的数据框中使用重复主题打破一列?