Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 846
Default Automatically Save

Hi,

I have created a quote template that ultimately gets saved to a network
drive. I know I can have VBA automatically save to a specific folder that I
program.
My question is, my group saves this quote in a particular folder based on
order #. So I have about 10 different folders that it could potentially be
saved in, based on where the order # falls. For example, the order # is
30256-10. The "-10" of the order # makes no difference. Therefore this file
would be saved in the 30000-39999 range. There are folders with ranges of
20000-29999, 30000-39999, 40000-49999 etc.. How can I have VBA analzye the
sales order # (say in cell L10) and save to the appropriate folder (this case
30000-39999). These folders would be located in G:\server1\orders.

Thanks for any help.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Automatically Save

sOrderNumber = "30256-10"
(so sOrderNumber = worksheets(1).Range("L10").text)
sBase = Trim(Left(sOrderNumber,instr(1,sOrderNumber, _
"-",vbTextCompare)-1))
sUpper = application.RoundUp(clng(sBase),-4)-1
sLower = application.RoundDown(clng(sbase),-4)

after doing the above in the immediate window (for demo purposes), then
testing the results shows

? sbase, sUpper, sLower
30256 39999 30000

so your next step would be something like

thisworkbook.SaveAs "G:\server1\orders\" & sLower & "-" & sUpper & "\" & _
sbase & ".xls"

--
Regards,
Tom Ogilvy



"Brad" wrote in message
...
Hi,

I have created a quote template that ultimately gets saved to a network
drive. I know I can have VBA automatically save to a specific folder that

I
program.
My question is, my group saves this quote in a particular folder based on
order #. So I have about 10 different folders that it could potentially be
saved in, based on where the order # falls. For example, the order # is
30256-10. The "-10" of the order # makes no difference. Therefore this

file
would be saved in the 30000-39999 range. There are folders with ranges of
20000-29999, 30000-39999, 40000-49999 etc.. How can I have VBA analzye the
sales order # (say in cell L10) and save to the appropriate folder (this

case
30000-39999). These folders would be located in G:\server1\orders.

Thanks for any help.



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
save automatically Rich[_2_] Excel Discussion (Misc queries) 0 October 18th 07 11:19 AM
Save automatically ldiaz Excel Discussion (Misc queries) 1 February 22nd 06 06:45 AM
Save excel automatically Jeff Excel Discussion (Misc queries) 0 December 8th 05 05:01 PM
save automatically 1st sheet only shital shah Excel Programming 2 November 24th 05 11:49 AM
Save and exit automatically AnsiSys Excel Programming 2 June 11th 04 11:12 AM


All times are GMT +1. The time now is 10:26 AM.

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"