我无法从表格中的AB和AC列(“更新者”)到表格(“Historical_vol”)中引用,请任何人确认我在这里做错了什么吗?
Sub historical_vol()
Application.ScreenUpdating = True
'This will help to watch the status bar update
Application.Calculation = xlCalculationManual
Dim wb As Workbook, uPd As Worksheet, hV As Worksheet
Dim lr As Long, cl As Range
Set wb = ThisWorkbook
Set uPd = wb.Sheets("UPDATER")
Set hV = wb.Sheets("Historical_vol")
uPd.Activate
uPd.Range("AD4:AG4", Range("AD4").End(xlDown)).Clear
lr = uPd.Cells(Rows.Count, "AB").End(xlUp).Row
i = 0
For i = 4 To lr
hV.Range("A9:B9").Value = uPd.Range("AB" & i & ":AC" & i).Value
hV.Calculate
DoEvents
uPd.Range("AD" & i & ":AG" & i).Value = hV.Range("C9:F9").Value
Application.StatusBar = i - 3 & " / " & lr - 3
'View on status bar number of records completed out of total records (lr-3)
Next i
Application.Calculation = xlCalculationAutomatic
End Sub更新表

HISTORICAL_VOL片材

发布于 2022-05-03 13:50:54
试着换行
For Each cl In uPd.Range("AB4:AC4" & lr)至
For Each cl In uPd.Range("AB4:AC" & lr).Rows还有这条线
cl.Offset(0, 2).Resize(1, 4).Value = hV.Range("C9:F9").Value至
cl.Offset(0, 2).Resize(1, 3).Value = hV.Range("C9:F9").Valuehttps://stackoverflow.com/questions/72094846
复制相似问题