vba_monkey
Board Regular
- Joined
- Dec 18, 2013
- Messages
- 112
Hello,
This code code comes at the end of a macro and is supposed to save the workbook in the correct folder. cmbEndMonth is selected by the user in a userform and the workbook should be saved in the corresponding Quarter folder for that year. The codes works but it always saves the workbook in the Q1 folder no matter which cmbEndMonth is selected.
Can anyone see what's wrong?
Thanks
This code code comes at the end of a macro and is supposed to save the workbook in the correct folder. cmbEndMonth is selected by the user in a userform and the workbook should be saved in the corresponding Quarter folder for that year. The codes works but it always saves the workbook in the Q1 folder no matter which cmbEndMonth is selected.
Can anyone see what's wrong?
Code:
If cmbEndMonth = "1" Or "2" Or "3" Then
Quarter = "Q1"
ElseIf cmbEndMonth = "4" Or "5" Or "6" Then
Quarter = "Q2"
ElseIf cmbEndMonth = "7" Or "8" Or "9" Then
Quarter = "Q3"
Else
Quarter = "Q4"
End If
Filepath = "R:\SJE Shared\DMU\Data Checking\" & Year(Date) & "\" & Quarter & "\Gross Premium\"
ActiveWorkbook.SaveAs Filename:=Filepath & Replace(ActiveWorkbook.Name, "ver_3.0_LIVE.xlsm", Format(Date, "mm") & "_" & Format(Date, "dd") & ".xlsx"), FileFormat:=51, AccessMode:=xlShared
Thanks