2016-11-02 2 views
-2

나는 교육에서 일하기 때문에 CLV (Curriculum Level)와 등록 기간의 두 가지 정의 요소에 따라 자동으로 학생을 주제 선택에 할당하려고합니다.오류 424 개체 필요 VBA에서 ActiveCell을 사용하려고 시도 할 때

I는 (activecell.offset 사용) I 적절한 대응 셀의 값을 기록하기 위해 데이터 검증 목록에서 변수의 선택에 의해 트리거되어야 할 if then else 일련의 문장을 사용 VBA 코딩있다.

내 첫 번째 VBA 코딩 테스트는 활성 셀에 따라 "if"하나만 필요했으며 VBA 편집기에서 직접 트리거되었습니다. 데이터 유효성 검사 목록 선택에서 트리거하는 방법을 알지 못해서 테스트되었습니다.

And 명령을 사용하여 activecell에서 오프셋 된 두 개의 다른 변수를 입력하려고하자마자 Error 424 Object Required 문이 반환되었고 이유는 확실하지 않습니다.

본인은 통합 문서에 대한 링크를 포함 시켰으며 아래 코드도 게시했습니다. 어떤 도움을 주셔서 감사합니다! Curriculum Variations File

Sub StandardEntry() 
    If ActiveCell.Value = "Yes" And ActivCell.Offset(0, -1).Value = "Term 1" And ActiveCell.Offset(0, -2).Value = "CLV 7" Then 
     CLV7Term1 
    Else 
    If ActiveCell.Value = "Yes" And ActiveCell.Offset(0, -1).Value = "Term 2" And ActiveCell.Offset(0, -2).Value = "CLV 7" Then 
     CLV7Term2 
    Else 
    If ActiveCell.Value = "Yes" And ActiveCell.Offset(0, -1).Value = "Term 3" And ActiveCell.Offset(0, -2).Value = "CLV 7" Then 
     CLV7Term3 
    Else 
    If ActiveCell.Value = "Yes" And ActiveCell.Offset(0, -1).Value = "Term 4" And ActiveCell.Offset(0, -2).Value = "CLV 7" Then 
     CLV7Term4 
    Else 
    If ActiveCell.Value = "Yes" And ActiveCell.Offset(0, -1).Value = "Term 1" And ActiveCell.Offset(0, -2).Value = "CLV 8" Then 
     CLV8Term1 
    Else 
    If ActiveCell.Value = "Yes" And ActiveCell.Offset(0, -1).Value = "Term 2" And ActiveCell.Offset(0, -2).Value = "CLV 8" Then 
     CLV8Term2 
    Else 
    If ActiveCell.Value = "Yes" And ActiveCell.Offset(0, -1).Value = "Term 3" And ActiveCell.Offset(0, -2).Value = "CLV 8" Then 
     CLV8Term3 
    Else 
    If ActiveCell.Value = "Yes" And ActiveCell.Offset(0, -1).Value = "Term 4" And ActiveCell.Offset(0, -2).Value = "CLV 8" Then 
     CLV8Term4 
    Else 
    If ActiveCell.Value = "Yes" And ActiveCell.Offset(0, -1).Value = "Term 1" And ActiveCell.Offset(0, -2).Value = "CLV 9" Then 
     CLV9Term1 
    Else 
    If ActiveCell.Value = "Yes" And ActiveCell.Offset(0, -1).Value = "Term 2" And ActiveCell.Offset(0, -2).Value = "CLV 9" Then 
     CLV9Term2 
    Else 
    If ActiveCell.Value = "Yes" And ActiveCell.Offset(0, -1).Value = "Term 3" And ActiveCell.Offset(0, -2).Value = "CLV 9" Then 
     CLV9Term3 
    Else 
    If ActiveCell.Value = "Yes" And ActiveCell.Offset(0, -1).Value = "Term 4" And ActiveCell.Offset(0, -2).Value = "CLV 9" Then 
     CLV9Term4 
    End If 
    End If 
    End If 
    End If 
    End If 
    End If 
    End If 
    End If 
    End If 
    End If 
    End If 
    End If 
End Sub 
+0

시도한 코드를 게시하면 더 나은 응답을 얻을 수 있습니다. – mrbungle

+0

확인. 나는 그 파일에 대한 링크를 포함 시켰지만 나는 또한 지금 편집하여 포스트에 코드를 포함시켰다. 댓글 주셔서 감사합니다. – ManbyRiver

+0

첫 번째'If' 문에 오타가 있습니다 -'ActivCell' -. 이런 종류의 문제를 피하려면'Option Explicit'을 모든 모듈의 맨 위에 놓으십시오. – Comintern

답변

0

은 내가 필요한 모든 여분의 "전자는"문 경우 먼저 "ActivCell"에 있던 것으로 나타났다. 아 - 인생의 작은 것들! 편집 도움을 주신 @Comintern! 다행히 나는 이미 올바른 길을 걷고 있었다.

관련 문제