Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Modify Ron de Bruin Code; Save Specific Files to Specific Folders
I’m trying to come up with a way of saving files that end in a
specific number to a specific folder. So, I’d use =right(A2,1) and if the right most number is a 6, save to a folder named 6, if the right- most number is 2, save to a folder named 2, if the right most number is 5, save to a folder named 5, etc. My numbers would be in ColumnY. The Ron de Bruin code below is super-slick: http://www.rondebruin.nl/copy5_3.htm How can I modify that code to copy unique values to a sheet, save the sheet as the name of the value, and save each sheet to a SPECIFIC folder? Thanks for your time and consideration with this!! |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Modify Ron de Bruin Code; Save Specific Files to Specific Folders
On Aug 24, 12:54*am, ryguy7272 wrote:
I’m trying to come up with a way of saving files that end in a specific number to a specific folder. *So, I’d use =right(A2,1) and if the right most number is a 6, save to a folder named 6, if the right- most number is 2, save to a folder named 2, if the right most number is 5, save to a folder named 5, etc. *My numbers would be in ColumnY. The Ron de Bruin code below is super-slick: http://www.rondebruin.nl/copy5_3.htm How can I modify that code to copy unique values to a sheet, save the sheet as the name of the value, and save each sheet to a SPECIFIC folder? Thanks for your time and consideration with this!! Figured it out! Actually, I created the folders and just changed a few lines of code: ws1.AutoFilterMode = False rng.AutoFilter Field:=FieldNum, Criteria1:="=" & cell.Value ActiveSheet.Range("D3") = cell.Value 'Save the file and close it If Mid(cell.Value, 9, 1) = 0 Then foldername = "I:\Documents\ExcelTen\0\" WSNew.Parent.SaveAs foldername & cell.Value & FileExtStr, FileFormatNum WSNew.Parent.Close True ElseIf Mid(cell.Value, 9, 1) = 1 Then foldername = "I:\Documents\ExcelTen\1\" WSNew.Parent.SaveAs foldername & cell.Value & FileExtStr, FileFormatNum WSNew.Parent.Close True ElseIf Mid(cell.Value, 9, 1) = 2 Then foldername = "I:\Documents\ExcelTen\2\" WSNew.Parent.SaveAs foldername & cell.Value & FileExtStr, FileFormatNum WSNew.Parent.Close True . . . Else 'Mid(cell.Value, 9, 1) = 9 Then foldername = "I:\Documents\ExcelTen\9\" WSNew.Parent.SaveAs foldername & cell.Value & FileExtStr, FileFormatNum WSNew.Parent.Close True End If '9 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Copy files in sub folders to a specific directory | Excel Programming | |||
How to modify specific lines in a .ini file? | Excel Discussion (Misc queries) | |||
How to modify specific lines in a .ini file? | Excel Programming | |||
Create/modify date for specific sheets? | Excel Discussion (Misc queries) | |||
Reading files on a specific folders | Excel Programming |