Pull date of a file using excel vba -
I have problems with dates in Excel when I try to drag the date of the file inside a file, this hour , Minutes and seconds, though coding did not ask for it. Finally I found out that the data on the right of unusual date alignment in excel cell shows, while the correct data alignment shows data to the left. This will affect the unusual sorting problem. Please help and thank you
NextRow = Sheets ("Sheet1"). Room (rows number, "A"). End (xlUp) .0 + sheet in objFolder.files for each objFile ("Sheet1"). Room (NextRow, 1). Value = format (objFile.DateLastModified, "dd / mm / yyyy") NextRow = NextRow + 1 Next objFile sheet ("Sheet1"). Range ("C1") .Sort Key1: = Category ("C2"), Order 1: = xlAscending, Header: = xlYes Excel:
< Img src = "https: // I.stack.imgur.com/8KEfL.png" alt = "Enter image details here">
Visual Basic:
replace with "mm / dd / yyyy" - using the VBA US format internally ! Alternatively, you simply have the date value internally without conversion, excel your Change the string to a date number again!: -)
In this way, just use this line:
Sheets ("Sheet1"). Cell (NextRow, 1) = objFile.DateLastModified
Comments
Post a Comment