"对象变量或块变量未设置"

时间:2015-11-03 02:46:26

标签: excel vba loops

我正在尝试遍历工作簿,获取一些价值并存储在另一个工作表中。以下是我的代码。 Keepp获取VBA对象变量或使用块变量未设置错误。

有人能帮助我找出哪里出错吗?

Sub analysis()

Dim i As Integer
Dim ws As Worksheet

For i = 4 To 197
    ws = ActiveWorkbook.Sheets(i)
    ws.Cells(1, 9) = ìstandardevî
    ws.Cells(2, 9) = Application.WorksheetFunction.StDev(Range("D3:D34"))
    ActiveWorkbook.Sheets(4).Cells(2, 1) = ws.Cells(2, 1)
    Sheets(4).Cells(2, 2) = ws.Cells(3, 8)
    Sheets(4).Cells(2, 3) = ws.Cells(2, 9)
Next i


End Sub

1 个答案:

答案 0 :(得分:4)

For / Next循环中的第一行是:

Set ws = ActiveWorkbook.Sheets(i)

将其更改为:

$ rsync --recursive --include="data.zip" --include="*.txt" --filter="-! */" dir_1 copy_of_dir_1