문제4번-2 프로시저 문제인데 책과 동일하게 했는데 오류가 납니다
이유가 궁금하네요. 다른 프로시저 문제 풀때도 동일한 문제가 발생합니다.
파일첨부
Private Sub cmd입력_Click()
If Val(txtTOEIC) > 100 Or Val(txt컴퓨터) > 100 Or Val(txt전공2) > 100 Then
MsgBox "점수는 0~100 사이의 값으로 입력하세요"
입력행 = [b2].Row + [b2].CurrentRegion.Rows.Count
Else
Cells(입력행, 2) = txt이름
Cells(입력행, 3) = Format(txt학번, ">&&&&&&")
Cells(입력행, 4) = cmb학과명
Cells(입력행, 5) = Val(txt토익)
Cells(입력행, 6) = Val(txt컴퓨터)
Cells(입력행, 7) = Val(txt전공2)
cmb학과명.Locked = True
End If
End Sub
Private Sub cmd입력_Click()
If Val(txtTOEIC) > 100 Or Val(txt컴퓨터) > 100 Or Val(txt전공2) > 100 Then
MsgBox "점수는 0~100 사이의 값으로 입력하세요"
Else
입력행 = [b2].Row + [b2].CurrentRegion.Rows.Count
Cells(입력행, 2) = txt이름
Cells(입력행, 3) = Format(txt학번, ">&&&&&&")
Cells(입력행, 4) = cmb학과명
Cells(입력행, 5) = Val(txt토익)
Cells(입력행, 6) = Val(txt컴퓨터)
Cells(입력행, 7) = Val(txt전공2)
cmb학과명.Locked = True
End If
End Sub
입력행을 else 위에 적으셨는데 else 아래에 적으면 정확한 결과가 나옵니다.
좋은 하루 되세요.
-
*2018-01-10 23:24:11
Private Sub cmd입력_Click()
If Val(txtTOEIC) > 100 Or Val(txt컴퓨터) > 100 Or Val(txt전공2) > 100 Then
MsgBox "점수는 0~100 사이의 값으로 입력하세요"
입력행 = [b2].Row + [b2].CurrentRegion.Rows.Count
Else
Cells(입력행, 2) = txt이름
Cells(입력행, 3) = Format(txt학번, ">&&&&&&")
Cells(입력행, 4) = cmb학과명
Cells(입력행, 5) = Val(txt토익)
Cells(입력행, 6) = Val(txt컴퓨터)
Cells(입력행, 7) = Val(txt전공2)
cmb학과명.Locked = True
End IfEnd Sub
Private Sub cmd입력_Click()
If Val(txtTOEIC) > 100 Or Val(txt컴퓨터) > 100 Or Val(txt전공2) > 100 Then
MsgBox "점수는 0~100 사이의 값으로 입력하세요"Else
입력행 = [b2].Row + [b2].CurrentRegion.Rows.Count
Cells(입력행, 2) = txt이름
Cells(입력행, 3) = Format(txt학번, ">&&&&&&")
Cells(입력행, 4) = cmb학과명
Cells(입력행, 5) = Val(txt토익)
Cells(입력행, 6) = Val(txt컴퓨터)
Cells(입력행, 7) = Val(txt전공2)
cmb학과명.Locked = True
End IfEnd Sub
입력행을 else 위에 적으셨는데 else 아래에 적으면 정확한 결과가 나옵니다.
좋은 하루 되세요.