A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data
This macro will loop through all the cells in column B and update the file path based on the date in column A.
Sub UpdateFilePath()
Dim ws As Worksheet
Dim lastRow As Long
Dim cell As Range
Dim dateValue As String
Dim filePath As String
Set ws = ThisWorkbook.Sheets("Sheet1") ' Change "Sheet1" to your sheet name
lastRow = ws.Cells(ws.Rows.Count, "A").End(xlUp).Row
For Each cell In ws.Range("B1:B" & lastRow)
If IsDate(ws.Cells(cell.Row, 1).Value) Then
dateValue = Format(ws.Cells(cell.Row, 1).Value, "m-d-yyyy")
filePath = "='R:\Countess - Corporate\_Shared\Control Room\Prorated production report\2024 Prorated Reports\[" & dateValue & ".xlsm]Flowrates'!$D$19"
cell.Value = filePath
End If
Next cell
End Sub