프로시저 해설에 ROWS.COUNT에 -1하면 안 되는 거 아닌가요, 실제로 해보면 기존에 있던 데이터가 사라져버립니다만
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
좋은 하루 되세요.