Bạn thử thêm các dòng code sau: ( màu đỏ)
Private Sub chon_Click()
t = Cells(Rows.Count, 3).End(xlUp).Row
Range(Cells(9, 4), Cells(t, 12)).Select
Range("D9").Activate
i = ActiveCell.Row
ii = i
k = ActiveCell.Column
kk = k
c = Application.Selection.Columns.Count
r = Application.Selection.Rows.Count
End Sub
Private Sub chon2_Click()
t = Cells(Rows.Count, 3).End(xlUp).Row
Range(Cells(9, 15), Cells(t, 23)).Select
Range("O9").Activate
i = ActiveCell.Row
ii = i
k = ActiveCell.Column
kk = k
c = Application.Selection.Columns.Count
r = Application.Selection.Rows.Count
End Sub