Hello,
My Idea is, that wenn i run the code, a Sheet is saved in a folder like the cell Value (B5). And if the Folder doesn't exist it will be created with the Cell Value (B5)
My code so far:
Dim Path As String
Dim filename As String
Dim wb As Workbook
Set wb = Workbooks.Add
ThisWorkbook.Sheets("Sheet2").Copy Before:=wb.Sheets(1)
Path = "C:\Users\Desktop\test\"
filename = Worksheets("Sheet2").Range("B5").Value & "_" & Worksheets("Sheet2").Range("E5").Value & ".xls"
wb.SaveAs filename:=Path & filename & ".xls"
so i can save the File with the Values of Cell (B5) and (E5) in the Folder "test"
But i want it to save the File, if for example the Cell Value (B5) is "ABCD", in the Path: C:\Users\Desktop\test\ABCD\
and if the Cell Value is "EFGH" in the Path C:\Users\Desktop\test\EFGH\ an so on.
Can someone please help me?
My Idea is, that wenn i run the code, a Sheet is saved in a folder like the cell Value (B5). And if the Folder doesn't exist it will be created with the Cell Value (B5)
My code so far:
Dim Path As String
Dim filename As String
Dim wb As Workbook
Set wb = Workbooks.Add
ThisWorkbook.Sheets("Sheet2").Copy Before:=wb.Sheets(1)
Path = "C:\Users\Desktop\test\"
filename = Worksheets("Sheet2").Range("B5").Value & "_" & Worksheets("Sheet2").Range("E5").Value & ".xls"
wb.SaveAs filename:=Path & filename & ".xls"
so i can save the File with the Values of Cell (B5) and (E5) in the Folder "test"
But i want it to save the File, if for example the Cell Value (B5) is "ABCD", in the Path: C:\Users\Desktop\test\ABCD\
and if the Cell Value is "EFGH" in the Path C:\Users\Desktop\test\EFGH\ an so on.
Can someone please help me?