TaskMaster
Board Regular
- Joined
- Oct 15, 2020
- Messages
- 75
- Office Version
- 365
- 2016
- Platform
- Windows
Hi All,
Im hoping you can help with the following. I am attempting to use a reference in cell A4 to decide where to save the spreadsheet. I am getting an error on my first Elseif saying Compile error: Else without if
Thank you in advance
Im hoping you can help with the following. I am attempting to use a reference in cell A4 to decide where to save the spreadsheet. I am getting an error on my first Elseif saying Compile error: Else without if
Thank you in advance
VBA Code:
Sub Save()
Dim FileName As String
Dim Folder1
Dim Folder2
Dim Folder3
FileName = ThisWorkbook.Worksheets("Summary").Range("A1")
Folder1 = "C:\Users\Flow\Desktop\Test\Monday\"
Folder2 = "C:\Users\Flow\Desktop\Test\Tuesday\"
Folder3 = "C:\Users\Flow\Desktop\Test\Wednesday\"
If ThisWorkbook.Worksheets("Summary").Range("A4") = "Monday" Then ActiveWorkbook.SaveAs Folder1 & FileName & ".xlsm", 52
ElseIf ThisWorkbook.Worksheets("Summary").Range("A4") = "Tuesday" Then ActiveWorkbook.SaveAs Folder2 & FileName & ".xlsm", 52
ElseIf ThisWorkbook.Worksheets("Summary").Range("A4") = "Wednesday" Then ActiveWorkbook.SaveAs Folder3 & FileName & ".xlsm", 52
Else: Call Manual_Save
End If
End Sub