Good Morning,
Everyone is doing well !!
Though I am still in the learning phase and in past years learned so much from Forums and Youtube videos.
Need help with the below code where I have successfully saved the files in a folder by giving them a location and the location we need to put in the reference sheet.
I was also trying to write something that creates the current date folder first and then saves all the files in it but not sure how I make it hence I removed that part.
please help me how do I want all the files should always save in the current date folder?
also attached the same tool file the code in it is working fine I just want to know if we can save the files in the current folder and if the current date folder exits it shows the warning
Everyone is doing well !!
Though I am still in the learning phase and in past years learned so much from Forums and Youtube videos.
Need help with the below code where I have successfully saved the files in a folder by giving them a location and the location we need to put in the reference sheet.
I was also trying to write something that creates the current date folder first and then saves all the files in it but not sure how I make it hence I removed that part.
Option Explicit
Sub Seperate_Data_in_workbooks()
Application.ScreenUpdating = False
Dim data_sh As Worksheet
Set data_sh = ThisWorkbook.Sheets("Data")
Dim Refrence_Sh As Worksheet
Set Refrence_Sh = ThisWorkbook.Sheets("Refrences")
Dim nwb As Workbook
Dim nsh As Worksheet
''''' Get unique supervisors
Refrence_Sh.Range("A:A").Clear
data_sh.AutoFilterMode = False
data_sh.Range("BH:BH").Copy Refrence_Sh.Range("A1")
Refrence_Sh.Range("A:A").RemoveDuplicates 1, xlYes
Dim i As Integer
For i = 2 To Application.CountA(Refrence_Sh.Range("A:A"))
data_sh.UsedRange.AutoFilter 60, Refrence_Sh.Range("A" & i).Value
Set nwb = Workbooks.Add
Set nsh = nwb.Sheets(1)
data_sh.UsedRange.SpecialCells(xlCellTypeVisible).Copy nsh.Range("A1")
nsh.UsedRange.EntireColumn.ColumnWidth = 15
nwb.SaveAs Refrence_Sh.Range("H1").Value & "/" & Refrence_Sh.Range("A" & i).Value & ".xlsx"
nwb.Close False
data_sh.AutoFilterMode = False
Next i
Refrence_Sh.Range("A:A").Clear
MsgBox "Done"
End Sub
please help me how do I want all the files should always save in the current date folder?
also attached the same tool file the code in it is working fine I just want to know if we can save the files in the current folder and if the current date folder exits it shows the warning