View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein Rick Rothstein is offline
external usenet poster
 
Posts: 5,934
Default in excel, how do i list all folders and last modified dates??

Yes, as far as I know, you would need a VBA macro to do this. You didn't
tell us where you wanted the list to be, so I had to make a guess. Assuming
your "location" (the c:\tenp you mentioned) is in a cell, select that cell
and this macro will put the directory names in the same column underneath it
and the last modified dates for them will be in the column next to it...

Dim Count As Long
Dim FileName As String
Dim LocationPath As String
LocationPath = ActiveCell.Value
If Right(LocationPath, 1) < "/" Then LocationPath = LocationPath & "\"
FileName = Dir(LocationPath & "*", vbDirectory)
Count = ActiveCell.Row
Do While Len(FileName)
If (GetAttr(LocationPath & FileName) And vbDirectory) = vbDirectory Then
If FileName < "." And FileName < ".." Then
Count = Count + 1
Cells(Count, ActiveCell.Column).Value = FileName
Cells(Count, ActiveCell.Column + 1).Value = _
FileDateTime(LocationPath & FileName)
End If
End If
FileName = Dir()
Loop

--
Rick (MVP - Excel)


"HHH" wrote in message
...
How can i list all folders and last modified dates in a particular
location?
for example if the location was c:\temp, i would expect a list of folders
(not files) and the last date modified....?? Does this involve using excel
vba script?