Hello all,
I'm looking to save my worksheets to a file location and sometimes my staff saves the month in different formats. Example: 01 - January or January or 01January
I want to have my files save to the location of the month "*January*"
For some reason my macro doesn't pick-up folders that have extra text in the folder name.
here is my code:
I'm looking to save my worksheets to a file location and sometimes my staff saves the month in different formats. Example: 01 - January or January or 01January
I want to have my files save to the location of the month "*January*"
For some reason my macro doesn't pick-up folders that have extra text in the folder name.
here is my code:
Code:
Set SPRpt = Sheets("S&P Revenue")
Dim Fldname As String
Dim FPath As String
Dim FBname As String
Dim Sname As String
Dim Gname As String
Dim Adate As Date
Adate = SPRpt.Range("C3")
Amth = SPRpt.Range("C2")
AYr = SPRpt.Range("C1")
Fldyr = Format(Adate, "yyyy")
Fldmth = Format(Adate, "*" & "mmmm") ' This is the month
Flddat = Format(Adate, "mm-dd-yy")
FBname = "FB_SPReport"
Sname = "Spa_SPReport"
Gname = "Golf_SPReport"
'FB
FPath = "S:\Finance\Income Audit\" & Fldyr & "\" & Fldmth & "\" & Flddat
Worksheets("S&P Revenue").Copy
ActiveWorkbook.SaveAs FPath & "\" & FBname, FileFormat:=51
ActiveWorkbook.Close