Sub LayTatCaTenSheet()
Dim ws As Worksheet
Dim outWs As Worksheet
Dim dong As Long
' N?u dã có sheet "DanhSachSheets" thì xóa di tru?c
On Error Resume Next
Application.DisplayAlerts = False
ThisWorkbook.Sheets("DanhSachSheets").Delete
Application.DisplayAlerts = True
On Error GoTo 0
' Tao sheet moi de ghi tên
Set outWs = ThisWorkbook.Sheets.Add
outWs.Name = "DanhSachSheets"
' Tieu de
outWs.Range("A1").Value = "So thu tu cua sheet"
outWs.Range("B1").Value = "Tên sheet"
dong = 2
' Duyet tat cac ca sheet
For Each ws In ThisWorkbook.Sheets
outWs.Cells(dong, 1).Value = ws.Index ' s? th? t? c?a sheet
outWs.Cells(dong, 2).Value = ws.Name ' tên sheet
dong = dong + 1
Next ws
MsgBox "Da lay danh sach sheet vao sheet " & outWs.Name
End Sub