Xin các anh chị chỉnh dùm đoạn code sau, mới học, còn yếu lắm, rất cảm ơn. Em thấy nó không được gọn mà em chưa biết dùng for...next trong trường hợp này. Xin anh chị tận tình chỉ giúp.
Private Sub CommandButton1_Click()
Dim TT As Boolean
TT = MsgBox("Hanh dong nay se xoa toan bo du lieu da nhap truoc day. Bam OK de xoa du lieu cu, nhap du lieu moi. Bam CANCEL de tiep tuc dung du lieu truoc day!", vbOKCancel, "CHU Y!")
If TT = True Then
pass = Application.InputBox("Xin nhap password")
If pass = "123" Then
Sheet1.Range("D6:F11").ClearContents
Sheet2.Range("A5:r40").ClearContents
Sheet3.Range("i5:l40").ClearContents
Sheet3.Range("P5
40").ClearContents
Sheet3.Range("r5:r40").ClearContents
Sheet3.Range("t5:t40").ClearContents
Sheet3.Range("u5:y40").ClearContents
Sheet3.Range("aa5:aa40").ClearContents
Sheet3.Range("ac5:ac40").ClearContents
Sheet3.Range("ae5:ae40").ClearContents
Sheet3.Range("af5:al40").ClearContents
Sheet5.Range("i5:l40").ClearContents
Sheet5.Range("P5
40").ClearContents
Sheet5.Range("r5:r40").ClearContents
Sheet5.Range("t5:t40").ClearContents
Sheet5.Range("u5:y40").ClearContents
Sheet5.Range("aa5:aa40").ClearContents
Sheet5.Range("ac5:ac40").ClearContents
Sheet5.Range("ae5:ae40").ClearContents
Sheet5.Range("af5:al40").ClearContents
Sheet7.Range("i5:l40").ClearContents
Sheet7.Range("P5
40").ClearContents
Sheet7.Range("r5:r40").ClearContents
Sheet7.Range("t5:t40").ClearContents
Sheet7.Range("u5:y40").ClearContents
Sheet7.Range("aa5:aa40").ClearContents
Sheet7.Range("ac5:ac40").ClearContents
Sheet7.Range("ae5:ae40").ClearContents
Sheet7.Range("af5:al40").ClearContents
Sheet9.Range("i5:l40").ClearContents
Sheet9.Range("P5
40").ClearContents
Sheet9.Range("r5:r40").ClearContents
Sheet9.Range("t5:t40").ClearContents
Sheet9.Range("u5:y40").ClearContents
Sheet9.Range("aa5:aa40").ClearContents
Sheet9.Range("ac5:ac40").ClearContents
Sheet9.Range("ae5:ae40").ClearContents
Sheet9.Range("af5:al40").ClearContents
Else
MsgBox ("Sai mat khau!")
End If
End If
End Sub