책 내용 질문하기
엑셀 507
도서
2021 시나공 컴퓨터활용능력 1급 실기
페이지
507
조회수
225
작성일
2022-02-19
작성자
탈퇴*원
첨부파일

프로시저 해설에 ROWS.COUNT에 -1하면 안 되는 거 아닌가요, 실제로 해보면 기존에 있던 데이터가 사라져버립니다만

답변
2022-02-22 15:33:33

Private Sub cmd조회_Click()

입 = [A3].Row + [A3].CurrentRegion.Rows.Count

Cells(입, 1) = txt반명.Value

Cells(입, 2) = txt이름.Value

Cells(입, 3) = txt1차.Value

Cells(입, 4) = txt2차.Value

txt합계.Value = txt1차.Value + txt2차.Value

 

 

End Sub

 

로 입력하셨는데요. 

 

아래와 같이 반대로 입력하셔야 합니다. 

 

입력행 = [a3].Row + [a3].CurrentRegion.Rows.Count - 1

    txt반명.Value = Cells(입력행, 1)

 

위와 같이 입력해야 셀에 입력된 내용이 폼에 표시가 되는 것입니다. 

 

 

Private Sub cmd조회_Click()

    입력행 = [a3].Row + [a3].CurrentRegion.Rows.Count - 1

    txt반명.Value = Cells(입력행, 1)

    txt이름.Value = Cells(입력행, 2)

    txt1차.Value = Cells(입력행, 3)

    txt2차.Value = Cells(입력행, 4)

    txt합계.Value = Val(txt1차.Value) + Val(txt2차.Value)

End Sub

 

좋은 하루 되세요. 

  • 관리자
    2022-02-22 15:33:33

    Private Sub cmd조회_Click()

    입 = [A3].Row + [A3].CurrentRegion.Rows.Count

    Cells(입, 1) = txt반명.Value

    Cells(입, 2) = txt이름.Value

    Cells(입, 3) = txt1차.Value

    Cells(입, 4) = txt2차.Value

    txt합계.Value = txt1차.Value + txt2차.Value

     

     

    End Sub

     

    로 입력하셨는데요. 

     

    아래와 같이 반대로 입력하셔야 합니다. 

     

    입력행 = [a3].Row + [a3].CurrentRegion.Rows.Count - 1

        txt반명.Value = Cells(입력행, 1)

     

    위와 같이 입력해야 셀에 입력된 내용이 폼에 표시가 되는 것입니다. 

     

     

    Private Sub cmd조회_Click()

        입력행 = [a3].Row + [a3].CurrentRegion.Rows.Count - 1

        txt반명.Value = Cells(입력행, 1)

        txt이름.Value = Cells(입력행, 2)

        txt1차.Value = Cells(입력행, 3)

        txt2차.Value = Cells(입력행, 4)

        txt합계.Value = Val(txt1차.Value) + Val(txt2차.Value)

    End Sub

     

    좋은 하루 되세요. 

· 5MB 이하의 zip, 문서, 이미지 파일만 가능합니다.
· 폭언, 욕설, 비방 등은 관리자에 의해 경고없이 삭제됩니다.