我想要做的是将数据从名为sheet的变量传输到某个工作表(" SUMMARY")。然后,我想考虑变量表中的单元格。因此,如果细胞> 0,然后它将该行复制到SUMMARY。但是我有一个'对象变量或者没有设置块变量'错误。我究竟做错了什么?
Sub transfer()
Dim ws As String
Dim n As Integer
Dim i As Long
Dim c As Range
n = Sheets("Start").Range("c24").Value + 3
If n > 0 Then
For i = 3 To n
Dim desrow As Integer
desrow = i - 1
Dim rng As Range
rng = Range("AA11:AA40")
For Each c In rng
If c = 12 Then
Sheets("OFFLIMITS").Cells(desrow, 1).Value = Sheets(i).Range("C3")
End If
Next c
Next i
End If
End Sub
答案 0 :(得分:1)
您必须Set
个对象,因此您需要说:
Set rng = Range("AA11:AA40")