Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 56
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 56
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy files in sub folders to a specific directory andreashermle Excel Programming 1 June 28th 10 10:22 PM
How to modify specific lines in a .ini file? Jim[_13_] Excel Discussion (Misc queries) 2 January 30th 10 08:35 PM
How to modify specific lines in a .ini file? Jim[_13_] Excel Programming 2 January 30th 10 12:29 PM
Create/modify date for specific sheets? Steve Vincent Excel Discussion (Misc queries) 3 September 17th 09 08:25 PM
Reading files on a specific folders Jaime[_3_] Excel Programming 2 August 11th 04 05:00 PM


All times are GMT +1. The time now is 06:45 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"