14년 3회 엑셀 프로시저문제
참조행 = lst분야.ListIndex
입력행 = [A5].Row + [A5].CurrentRegion.Rows.Count
If IsNull(lst분야) Then
MsgBox "분야를 선택하세요."
lst분야.ListIndex = 0
End If
Cells(입력행, 1) = lst분야.List(참조행, 0)
Cells(입력행, 2) = txt도서명
Cells(입력행, 3) = txt저자
Cells(입력행, 4) = Format(txt판매가, "#,##0")
제가 이렇게 짯는데 잘못된 배열이라고 뜨거든요
원래의 답은
참조행 = lst분야.ListIndex
입력행 = [A5].Row + [A5].CurrentRegion.Rows.Count
If IsNull(lst분야) Then
MsgBox "분야를 선택하세요."
lst분야.ListIndex = 0
Else
Cells(입력행, 1) = lst분야.List(참조행, 0)
Cells(입력행, 2) = txt도서명
Cells(입력행, 3) = txt저자
Cells(입력행, 4) = Format(txt판매가, "#,##0")
End If
이건데 차이좀 설명해주실수 있나요?
안녕하세요.
입력하신 형태는 'lst분야'가 Null이면 아래 코드를 실행하고,
If IsNull(lst분야) Then
MsgBox "분야를 선택하세요."
lst분야.ListIndex = 0
End If
무조건 아래 코드를 수행합니다.
Cells(입력행, 1) = lst분야.List(참조행, 0)
Cells(입력행, 2) = txt도서명
Cells(입력행, 3) = txt저자
Cells(입력행, 4) = Format(txt판매가, "#,##0")
해설에서는 Null 이 아닌 경우 Else 이하 코드를 수행합니다.
If IsNull(lst분야) Then
MsgBox "분야를 선택하세요."
lst분야.ListIndex = 0
Else
Cells(입력행, 1) = lst분야.List(참조행, 0)
Cells(입력행, 2) = txt도서명
Cells(입력행, 3) = txt저자
Cells(입력행, 4) = Format(txt판매가, "#,##0")
End If
좋은 하루 보내세요.
-
관리자2019-01-09 23:02:43
안녕하세요.
입력하신 형태는 'lst분야'가 Null이면 아래 코드를 실행하고,
If IsNull(lst분야) Then
MsgBox "분야를 선택하세요."
lst분야.ListIndex = 0
End If
무조건 아래 코드를 수행합니다.
Cells(입력행, 1) = lst분야.List(참조행, 0)
Cells(입력행, 2) = txt도서명
Cells(입력행, 3) = txt저자
Cells(입력행, 4) = Format(txt판매가, "#,##0")
해설에서는 Null 이 아닌 경우 Else 이하 코드를 수행합니다.
If IsNull(lst분야) Then
MsgBox "분야를 선택하세요."
lst분야.ListIndex = 0
Else
Cells(입력행, 1) = lst분야.List(참조행, 0)
Cells(입력행, 2) = txt도서명
Cells(입력행, 3) = txt저자
Cells(입력행, 4) = Format(txt판매가, "#,##0")
End If
좋은 하루 보내세요.