我在尝试编译时遇到此错误 . 复制单元格并粘贴到另一张表格的正确方法是什么?
子copypaste()
Dim col As Integer
Dim row As Integer
Dim copy As String
Dim newrow As Integer
Dim wrksht As Integer
wrksht = 3
newrow = 1
For col = 23 To 1 Step -1
Worksheets(3).Cells(33, col).copy
Worksheets(17).Cells(row, 1).PasteSpecial Transpose:=True
For row = 31 To 1 Step -1
If Worksheets(3).Cells(row, col).Value = "x" Then
Worksheets(17).Cells(newrow, 2).Value = Worksheets(12).Cells(row, 25).Value
newrow = newrow + 1
End If
Next row
Next col
结束子
1 回答
在你的行:
您试图在给它一个值之前使用变量行引用一个单元格 . 这可能是导致错误的原因 .