Skip to content

Instantly share code, notes, and snippets.

@DuongAQ
Created March 5, 2018 03:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DuongAQ/f69bad78a84f805f4c6c1c60bb7cfcc3 to your computer and use it in GitHub Desktop.
Save DuongAQ/f69bad78a84f805f4c6c1c60bb7cfcc3 to your computer and use it in GitHub Desktop.
Sub GetDirNames() 'Lấy danh sách tên file trong thư mục
Const sPath="C:\Test\" 'Đường dẫn tới thư mục
Dim sFil As String
sFil=Dir(sPath & "*.xl*") 'đuôi file .xlsx .xlsb .xlsm... đều sử dụng được
Do While sFil <> ""
Range("D65536").End(xlUp)(2).Value=sPath & sFil 'Lấy danh sách các tên file trong thư mục
sFil=Dir
Loop
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment