Thanks! I am attaching my code because I am getting an error message saying that I'm missing and End If when I apply that code to my existing code
It is a long code, hopefully you can interpret it. I am not 100% "code" savy but I can help to explain when needed. For the Else statement, if it can take the selection for userform 2 (Phase ) and apply it to userform 1 (Save_As) that would be ideal but i'm not sure how that would look in code.
Private Sub Save_File_Click()
Application.ScreenUpdating = False
Dim FileName As String
Dim Job_Number As String
Dim Parent_Folder As String
Dim Search As String
Dim Job_Folder As String
Dim Job_Year As String
Dim Full_Path As String
Dim Partial_Path As String
Dim Phase As String
Dim Description As String
Phase = Me.Project_Phase.Value
Description = Me.File_Description.Value
Private Sub CommandButton1_Click()
If Me.Save_As = vbNullString Then
Phase.Show
End If
End Sub
Sheets("Clip Connection").Select
Job_Number = Range("K1")
Job_Year = Left(Job_Number, 2)
If Job_Year = "" Then
Job_Number = InputBox("Insert project number")
Job_Year = Left(Job_Number, 2)
'Unload Me
Sheets("Clip Connection").Select
Range("k1").Value = Job_Number
End If
If Job_Year = 16 Then
Parent_Folder = "K:\Tech_Service_2016"
ElseIf Job_Year = 17 Then
Parent_Folder = "K:\Tech_Service_2017"
ElseIf Job_Year = 18 Then
Parent_Folder = "K:\Tech_Service_2018"
ElseIf Job_Year = 19 Then
Parent_Folder = "K:\Tech_Service_2019"
ElseIf Job_Year = 20 Then
Parent_Folder = "K:\Tech_Service_2020"
ElseIf Job_Year = 21 Then
Parent_Folder = "K:\Tech_Service_2021"
ElseIf Job_Year = 22 Then
Parent_Folder = "K:\Tech_Service_2022"
Else
MsgBox ("Cannot find job folder in the directory")
Unload Me
Sheets("Clip Connection").Select
Exit Sub
End If
Search = Parent_Folder & Job_Number & "*"
Job_Folder = Dir(Search, vbDirectory)
FileName = Range("k1") & " Connection Design - Pullout (" & Description & ")"
If Phase = "Estimate" Then
Partial_Path = Parent_Folder & Job_Folder & "\Engineering\Estimate"
If Dir(Partial_Path, vbDirectory) = "" Then
MkDir (Partial_Path)
End If
Full_Path = Partial_Path & FileName & ".xlsm"
ElseIf Phase = "Approval A" Then
Partial_Path = Parent_Folder & Job_Folder & "\Engineering\Approval A"
If Dir(Partial_Path, vbDirectory) = "" Then
MkDir (Partial_Path)
End If
Full_Path = Parent_Folder & Job_Folder & "\Engineering\Approval A" & FileName & ".xlsm"
ElseIf Phase = "Approval B" Then
Partial_Path = Parent_Folder & Job_Folder & "\Engineering\Approval B"
If Dir(Partial_Path, vbDirectory) = "" Then
MkDir (Partial_Path)
End If
Full_Path = Parent_Folder & Job_Folder & "\Engineering\Approval B" & FileName & ".xlsm"
ElseIf Phase = "Approval C" Then
Partial_Path = Parent_Folder & Job_Folder & "\Engineering\Approval C"
If Dir(Partial_Path, vbDirectory) = "" Then
MkDir (Partial_Path)
End If
Full_Path = Parent_Folder & Job_Folder & "\Engineering\Approval C" & FileName & ".xlsm"
ElseIf Phase = "Approval D" Then
Partial_Path = Parent_Folder & Job_Folder & "\Engineering\Approval D"
If Dir(Partial_Path, vbDirectory) = "" Then
MkDir (Partial_Path)
End If
Full_Path = Parent_Folder & Job_Folder & "\Engineering\Approval D" & FileName & ".xlsm"
ElseIf Phase = "Construction 0" Then
Partial_Path = Parent_Folder & Job_Folder & "\Engineering\Construction 0"
If Dir(Partial_Path, vbDirectory) = "" Then
MkDir (Partial_Path)
End If
Full_Path = Parent_Folder & Job_Folder & "\Engineering\Construction 0" & FileName & ".xlsm"
ElseIf Phase = "Construction 1" Then
Partial_Path = Parent_Folder & Job_Folder & "\Engineering\Construction 1"
If Dir(Partial_Path, vbDirectory) = "" Then
MkDir (Partial_Path)
End If
Full_Path = Parent_Folder & Job_Folder & "\Engineering\Construction 1" & FileName & ".xlsm"
ElseIf Phase = "Construction 2" Then
Partial_Path = Parent_Folder & Job_Folder & "\Engineering\Construction 2"
If Dir(Partial_Path, vbDirectory) = "" Then
MkDir (Partial_Path)
End If
Full_Path = Parent_Folder & Job_Folder & "\Engineering\Construction 2" & FileName & ".xlsm"
ElseIf Phase = "Construction 3" Then
Partial_Path = Parent_Folder & Job_Folder & "\Engineering\Construction 3"
If Dir(Partial_Path, vbDirectory) = "" Then
MkDir (Partial_Path)
End If
Full_Path = Parent_Folder & Job_Folder & "\Engineering\Construction 3" & FileName & ".xlsm"
End If
With ws
Sheets("index").Select
Range("K2").Select
ActiveCell.Value = Me.File_Description.Value
End With
Sheets("Clip Connection").Select
ActiveWorkbook.SaveAs FileName:=Full_Path
Unload Me
End Sub
Private Sub UserForm_Click()
End Sub
thank you for all your help!!