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


Each month I copy 20 division files into a consolidated spreadsheet and
e-mail the spreadsheet to a user group.

The files are saved in a division folder (for example: C: Division 1)
by month.
The file names are Division 1 expenses_July 2005.

The consolidated spreadsheet has a tab for each division and uses prior
month data.

Is there a way to have a Macro:

1) Find the prior month expense file for each division on the C: Drive
and copy the information to the appropriate tab on the consolidated
spreadsheet.

For example the consolidated spreadsheet for August 2005 would have a
macro copy the Division 1 expenses_July 2005 information onto the
Division 1 tab and repeat for all 20 divisions.

Since the file name does not change (except the date), the big issue is
getting Excel to identify the proper period (i.e the month) and copy the
prior month to the current period spreadsheet.

Any help would be greatly appreciated!


--
STEVEB
------------------------------------------------------------------------
STEVEB's Profile: http://www.excelforum.com/member.php...fo&userid=1872
View this thread: http://www.excelforum.com/showthread...hreadid=396972

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default copying files

Start by selecting the current month using a variable.

Ex.
Dim dteMonth as Date
Dim strMonth as String

dteMonth = Date()
'This will get you the previous month.
dteMonth = DateAdd("m",-1,dteMonth)
Sheets(" & dteMonth & ").Select

You can format the strMonth variable any way you want.
strMonth = dteMonth
strMonth = Format(dteMonth,"mmm,yyyy")

"STEVEB" wrote:


Each month I copy 20 division files into a consolidated spreadsheet and
e-mail the spreadsheet to a user group.

The files are saved in a division folder (for example: C: Division 1)
by month.
The file names are Division 1 expenses_July 2005.

The consolidated spreadsheet has a tab for each division and uses prior
month data.

Is there a way to have a Macro:

1) Find the prior month expense file for each division on the C: Drive
and copy the information to the appropriate tab on the consolidated
spreadsheet.

For example the consolidated spreadsheet for August 2005 would have a
macro copy the Division 1 expenses_July 2005 information onto the
Division 1 tab and repeat for all 20 divisions.

Since the file name does not change (except the date), the big issue is
getting Excel to identify the proper period (i.e the month) and copy the
prior month to the current period spreadsheet.

Any help would be greatly appreciated!


--
STEVEB
------------------------------------------------------------------------
STEVEB's Profile: http://www.excelforum.com/member.php...fo&userid=1872
View this thread: http://www.excelforum.com/showthread...hreadid=396972


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
Copying from different files into 1 LiAD Excel Discussion (Misc queries) 1 November 4th 09 01:57 PM
Copying Files RH206 Excel Discussion (Misc queries) 2 April 1st 08 08:21 PM
Copying files fds Excel Worksheet Functions 1 July 27th 05 12:55 AM
Copying files in VB Reney R. Langlois Excel Programming 1 September 29th 04 08:34 PM
Copying files from PC to PC Alan Perry Excel Programming 1 September 23rd 04 07:48 PM


All times are GMT +1. The time now is 12:42 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"