2016-06-28 5 views
1
For j = 1 To numrows - 1 
     erow = Cells(Rows.count, 10 + j).End(xlUp).Row 
     totalMins = Cells(erow, 10 + j) 
     MsgBox (totalMins) 
     Range(Cells(erow, 10 + j), Cells(erow, 10 + j).End(xlUp)).Cut 
     Cells(20, 20).PasteSpecial xlPasteValues 
    Next 

pastespecial 범위 클래스에 오류가 계속 발생합니다. 이것이 실패한 이유는 무엇이며 어떻게하면 코드를 수정할 수 있습니까?잘라 내기 및 붙여 넣기 범위 vba

+1

난 당신이 컷을 사용하여 바로 값을 붙여 넣을 수 있다고 생각하지 않습니다. –

+0

예, 동일한 작업을 수행하기 위해 내용을 지우십시오. 감사! – aggieman

답변

2

잘라 내기에서 특수 문자를 붙여 넣을 수 없습니다. 사용하여 더 나은 아직

For j = 1 To numrows - 1 
     erow = Cells(Rows.count, 10 + j).End(xlUp).Row 
     totalMins = Cells(erow, 10 + j) 
     MsgBox (totalMins) 
     Range(Cells(erow, 10 + j), Cells(erow, 10 + j).End(xlUp)).Cut Cells(20, 20) 
    Next 

또는를 :

For j = 1 To numrows - 1 
     erow = Cells(Rows.count, 10 + j).End(xlUp).Row 
     totalMins = Cells(erow, 10 + j) 
     MsgBox (totalMins) 
     Cells(20, 20) =Range(Cells(erow, 10 + j), Cells(erow, 10 + j).End(xlUp)) 
     Range(Cells(erow, 10 + j), Cells(erow, 10 + j).End(xlUp)).ClearContents 
    Next 
+1

안녕하세요, 1K에 오신 것을 환영합니다! –

관련 문제