Difficult to explain but my picture will make it clear.
My Excel sheet has hyperlinks in column a that links to the file for opening but how to get the lastmodifieddate from that file in column l
Example : a22 is linked to file vimco, so what is the last modifieddate from that file has to come in l22
also not all rows in column a has hyperlinks and contains also a empty or not linked cell so if that is so than nothing has to show in column l it has to be blank if a is blank or not linked
can it make a formula? so i type in cell =moddate and then shows the date is ok now
ok got the code now
Function GetDateTime(myCell As Range) As Date
Dim myHyperlink As Hyperlink
Dim Filename As String
Application.Volatile
On Error Resume Next
Set myHyperlink = myCell.Hyperlinks(1)
On Error GoTo 0
If Not myHyperlink Is Nothing Then
Filename = myHyperlink.Address
'If it is a relative address insert this workbook's path
If Not (Filename Like "\\*" Or Filename Like "[A-Z]:\*") Then
Filename = ThisWorkbook.path & "\" & Filename
End If
If Dir(Filename, vbNormal) <> "" Then
GetDateTime = FileDateTime(Filename)
Else
GetDateTime = ""
End If
Else
GetDateTime = ""
End If
End Function
but now second thing if the link changes or I open my workbook or swap sheets is not updating the value of getdatetime - can that be fixed?