我在尝试编译时遇到此错误。复制单元格并粘贴到另一张纸的正确方法是什么?
Sub 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
End Sub
答案 0 :(得分:0)
在你的行中:
Worksheets(17).Cells(row, 1).PasteSpecial Transpose:=True
您尝试在为其提供值之前使用变量行引用单元格。这可能是导致错误的原因。