답지에서는
Private Sub cmd입력_Click()
참조행 = lst품목.ListIndex + 4
입력행 = [a2].Row + [a2].CurrentRegion.Rows.Count
If opt카드.Value = True Then
Cells(입력행, 1) = "카드"
Else
Cells(입력행, 1) = "현금"
End If
Cells(입력행, 2) = txt현금영수증번호.Value
Cells(입력행, 3) = Cells(참조행, 8)
Cells(입력행, 4) = Cells(참조행, 9)
Cells(입력행, 5) = txt개수.Value
If opt카드.Value = True Then
Cells(입력행, 6) = Cells(입력행, 4) * Cells(입력행, 5) * 0.95
Else
Cells(입력행, 6) = Cells(입력행, 4) * Cells(입력행, 5)
End If
End Sub
인데 저는
Private Sub cmd입력_Click()
i = [a2].Row + [a2].CurrentRegion.Rows.Count
If opt카드 = True Then
Cells(i, 1) = "카드"
Else
Cells(i, 1) = "현금"
End If
Cells(i, 2) = txt현금영수증번호
Cells(i, 3) = lst품목.List(lst품목.ListIndex, 0)
Cells(i, 4) = lst품목.List(lst품목.ListIndex, 1)
Cells(i, 5) = txt개수.Value
If opt카드 = True Then
Cells(i, 6) = (Cells(i, 5) * Cells(i, 4)) - (Cells(i, 5) * Cells(i, 4)) * 0.05
Else
Cells(i, 6) = Cells(i, 5) * Cells(i, 4)
End If
End Sub
와 같이 listindex를 다르게 사용하였습니다. 실제 시험장에서 이렇게 답을 작성해도 정답으로 인정이 되는지 궁금합니다.
문제의 지시사항에 맞게 지정하고 정확한 결과가 나오면 정답으로 인정 됩니다.
좋은 하루 되세요.
-
관리자2022-11-02 11:19:34
문제의 지시사항에 맞게 지정하고 정확한 결과가 나오면 정답으로 인정 됩니다.
좋은 하루 되세요.