我有一个错误,并认为我通过将表单更改为
来修复它ActiveWorkbook.Worksheet
但后来收到运行时错误438对象不支持此属性错误。 (excel 2010) 我该怎么做才能消除此错误并使其运行?
Dim i As Long, j As Long, lastrow1 As Long, lastrow2 As Long
Dim merchant As String
lastrow1 = ActiveWorkbook.Worksheet(“Completed”).Range(“B” & Rows.Count).End(xlUp).Rows 'Fails here - Runtime error 438 Object doesnt support this property.
For i = 2 To lastrow1
merchant = ActiveWorkbook.Worksheet(“Completed”).Cells(i, “B”).Value
ActiveWorkbook.Worksheet(“RawData”).Activate
lastrow2 = ActiveWorkbook.Worksheet(“RawData”).Range(“B” & Rows.Count).End(xlUp).Row
For j = 2 To lastrow2
If ActiveWorkbook.Worksheet(“RawData”).Cells(j, “B”).Value = merchant Then
ActiveWorkbook.Worksheet(“Completed”).Activate
ActiveWorkbook.Worksheet(“Completed”).Range(Cells(i, “J”), Cells(i, “L”)).Copy
ActiveWorkbook.Worksheet(“RawData”).Activate
ActiveWorkbook.Worksheet(“RawData”).Range(Cells(j, “R”), Cells(j, “T”)).Select
ActiveSheet.Paste
End If
Next j
Application.CutCopyMode = False
Next i
ActiveWorkbook.Worksheet(“Completed”).Activate
ActiveWorkbook.Worksheet(“Completed”).Range(“B1”).Select
非常感谢任何帮助。 干杯!