, 당신이보고있는 Application-defined or object-defined error
당신의 Endcolumn
변수는 엑셀 Range
1 기반이기 때문에 이런 일이 0 인 경우,
Sub ErrorExample()
On Error GoTo ErrHandler ' Set the Error Handling Condition
' in this case, if an error occurs
' goto the ErrHandler label
' do stuff
Debug.Print "I am in `do stuff` code"
Range(Worksheets("Search Engine").Cells(9, 1),
Worksheets("Search Engine").Cells(Endcolumn,
Endrow + 2)).Select Selection.RowHeight = 20
Exit Sub ' Exit from the Sub gracefully and do not run the
' following lines of code (if this is not
' included, the ErrHandler code will run in all
' cases, not just error cases
Debug.Print "I will never run"
ErrHandler:
Debug.Print "I am in the error code"
' Code to run in case of error
ThisWorkbook.Worksheets("Search Engine").Protect ' protect your sheet
On Error GoTo 0 ' Reset the error handling condition
End Sub
01 : 그것을 처리하는 방법 0
특별히 오류 처리에서 가장 관심을 보인다 때문에이 여기에 대략의 열이 결코 의미하는 0 기반이 아닌
"오류"란 무엇입니까? – ApplePie
샘플 코드를 제공 할 수 있습니까? 글쎄, 내 지식에 나는 그것이 버그가 될 것이기 때문에 오류를 건너 뛸 수 없다고 생각한다 ... (?) – Trace
런타임 오류와 같은 오류로, 나는 목록을 통과하는 검색 엔진을 만들었다. 상관 데이터를 검색 엔진 시트로 전송하면 사용자가 시트의 데이터를 변경해서는 안되지만 검색 중에 런타임 오류가 발생하면 변경 될 수 있습니다. 나는 문지기 오류를주는 부분을 가지고 있지만 지금은 그것을 고쳤습니다. 그러나 예를 들면 그것을 넣을 것입니다 – user1545643