saving a file as today's date and switching between files

spq24

Board Regular
Joined
Jan 18, 2010
Messages
52
Hello,

I got a file to save as something and then it switches back to the file. This file will change each day because it has the days date in it. I want it to switch between two open windows then. The code I have, but it is not working is below.

The process: copy data from "wb 1" "sheet 1", create new workbook, paste data into sheet 1 of the new workbook, format data, save file as "wb 2 today's date" (wb 2 06/03/2011), go back to "wb 1", copy data from "wb 1" "sheet 2", select the newly saved workbook (wb 2 06/03/2011), and paste data into "wb 2" "sheet 2".

The main problem is switching between the two files.

To save the file (which works)-

Dim filetosave As String
Dim dir As String
dir = "C:\Users\squatr200\Desktop\Afternoon Reports\Metro E"
filetosave = Range("O29").Value & " " & Format(Now(), "mm-dd-yyyy")


switching between files
Windows("wb 2 & " " & Format(Now(), "mm-dd-yyyy")").Activate
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.

Forum statistics

Threads
1,224,550
Messages
6,179,459
Members
452,915
Latest member
hannnahheileen

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top