我遇到了错误 1004 的问题。错误是在使用粘贴功能的某个地方,但我不知道在哪里。
For i = 0 To citac
If pole(i + 1) - pole(i) > 1 Then
thissheet.Range("E" & CStr(pole(i) + 1) & ":E" & CStr(pole(i + 1))).Copy
Else
thissheet.Range("E" & CStr(pole(i) + 1)).Copy
End If
For j = 2 To thiswbk.Worksheets.Count
thiswbk.Sheets(j).Range("A1:A100000").Clear
If pole(i + 1) - pole(i) > 1 Then
thiswbk.Sheets(j).Range("A1:A" & CStr(pole(i + 1) - pole(i))).PasteSpecial xlPasteAll
Else
**thiswbk.Sheets(j).Range("A1").PasteSpecial xlPasteAll**<-problem
End If
Next j
Next i
感谢您的回答。
问题在于清除功能。这是一个解决方案:
For j = 2 To thiswbk.Worksheets.Count
thiswbk.Sheets(j).Range("A1:A100000").Clear
Next j
For i = 0 To citac
If pole(i + 1) - pole(i) > 1 Then
thissheet.Range("E" & CStr(pole(i) + 1) & ":E" & CStr(pole(i + 1))).Copy
Else
thissheet.Range("E" & CStr(pole(i) + 1)).Copy
End If
For j = 2 To thiswbk.Worksheets.Count
If pole(i + 1) - pole(i) > 1 Then
thiswbk.Worksheets(j).Range("A1:A" & CStr(pole(i + 1) - pole(i))).PasteSpecial xlPasteAll
Else
thiswbk.Worksheets(j).Range("A1").PasteSpecial xlPasteAll
End If
Next j
Next i
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句