我知道这可能是一个简单的修复程序,但我似乎无法对其进行调试。 有人可以解释一下为什么我的第一个过去移置仍然给我很多错误(包括语法)
感谢帮助。
Sub Clean()
Dim tRow As Long
Dim bRow As Long
Dim Range As Long
tRow = 8
bRow = Cells(Rows.Count, "C").End(xlUp).row
Worksheets("Canadian").Activate
Worksheets("Canadian").Range("E251:E267").Copy
Worksheets("SectorSort").Activate
.Range(.Cells((bRow + 4), "C")), (.Cells((bRow + 4), "R")).PasteSpecial (xlPasteValues), Transpose:=True
End With
With ThisWorkbook.Worksheets("SectorSort")
Range = bRow - tRow + 1
.Range(.Cells(tRow, "C"), .Cells(bRow, "C")).Copy
.Range(.Cells(bRow + 3, "C"), .Cells((bRow + 3 + Range), "C")).PasteSpecial (xlPasteValues)
End With
答案 0 :(得分:0)
先确认您的某些范围未绑定到父级
bRow = Cells(Rows.Count, "C").End(xlUp).row
将此内容放入
然后您要激活工作表,不要只是参考它们。
接下来,您将其中一个.Activate
视为With
最后,您在粘贴中遇到了()
错误。
Dim tRow As Long
Dim bRow As Long
Dim rng As Long
tRow = 8
Worksheets("Canadian").Range("E251:E267").Copy
With Worksheets("SectorSort")
bRow = .Cells(Rows.Count, "C").End(xlUp).Row
.Range(.Cells((bRow + 4), "C"), .Cells((bRow + 4), "R")).PasteSpecial (xlPasteValues), Transpose:=True
rng = bRow - tRow + 1
.Range(.Cells(tRow, "C"), .Cells(bRow, "C")).Copy
.Range(.Cells(bRow + 3, "C"), .Cells((bRow + 3 + rng), "C")).PasteSpecial (xlPasteValues)
End With