I'm struggling to find a way to do this efficiently (or at all to be honest). Essentially, instead of using the snippet in red font, I'd like to grab the last 8 characters (prior to the file extension) of the file name; which are always YYYYMMDD and insert them into a cell in MM/DD/YY format. Thoughts on how I can do this?
VBA Code:
Sub GetDailyFiles()
Application.DisplayAlerts = False
Application.ScreenUpdating = False
Dim m, s As Workbook
Dim mS, mA, sS, sJ, sD As Worksheet
Dim sDate As String
Dim mSLR, mALR, sDLR As Long
Set m = ThisWorkbook
Set mS = m.Sheets("Summaries")
Set mA = m.Sheets("All_Data")
'Opens file picker and sets the chosen file as "s" for future coding reference.
With Application.FileDialog(3)
.AllowMultiSelect = False
If .Show Then
fullpath = .SelectedItems.Item(1)
Set s = Workbooks.Open(fullpath)
End If
'Exits the sub if no file is chosen.
If s Is Nothing Then Exit Sub
Set sS = s.Sheets("Summary")
Set sJ = s.Sheets("Job=1")
[COLOR=rgb(226, 80, 65)] 'Adds 20 days to the transaction date from the source file and enters it in the Summaries page of the destination file.
mS.Range("A" & Rows.Count).End(xlUp).Offset(1, 0).Value = DateAdd("d", 20, sS.Range("B7"))[/COLOR]