Home |
Search |
Today's Posts |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Press Alt + F11 to open the Visual Basic Editor, click INSERT on the menu and
select MODULE. Paste the following Macro code into the module and modify the value for strPath from "H:\Excel" to whatever drive and folder you're looking in: Sub MyDirFiles() Dim wb As Workbook Dim ws As Worksheet Dim strPath As String Dim strDir As String Dim lngRowOffset As Long Dim strFiledate As String Dim strFileTime As String Dim strFileDateTime As String Set wb = ThisWorkbook Set ws = wb.Worksheets("Sheet1") strPath = "H:\Excel" "Chcnge this value to your path strDir = Dir(strPath & "\*.*") Do While strDir < "" With ws.Range("A1") .Offset(lngRowOffset).Value = strDir strFileDateTime = _ FileDateTime(strPath & "\" & strDir) .Offset(lngRowOffset, 1).Value = _ Left$(strFileDateTime, _ InStr(1, strFileDateTime, " ") - 1) .Offset(lngRowOffset, 2).Value = _ Right$(strFileDateTime, _ Len(strFileDateTime) - _ InStr(1, strFileDateTime, " ")) End With lngRowOffset = lngRowOffset + 1 strDir = Dir Loop Set wb = Nothing Set ws = Nothing End Sub Save and close the VBE and run it from Excel by clicking TOOLS/MACRO/MACROS and selecting MyDirFiles from the list. -- Kevin Backmann "Hal239" wrote: How do I create a detailed list of files in a directory, with date created, modified, etc? |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
how do you create file folder labels in excel? | New Users to Excel | |||
can I create backup file in separate folder from the original? | Setting up and Configuration of Excel | |||
How to create a list of file names within a folder in Microsoft Ex | Excel Discussion (Misc queries) | |||
Create a copy in the same folder when a file is modified and saved | Excel Discussion (Misc queries) | |||
How do I Create backup of excel file in other folder | Excel Discussion (Misc queries) |