VBS Script

JPCMcAllen

New Member
Joined
May 17, 2007
Messages
22
I am new to Excel and am trying to assemble a script to copy the 1st and only worksheet in "1.xls" and paste it as a new worksheet among others in "2.xls" with the tab labeled with the date subtract 1 day that this runs. The intention is for it to run every day. Can someone assist? Thank you very much.
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Try:

Code:
ThisWorkbook.Sheets(1).Copy before:=Workbooks("2.xls").Sheets(1)
Workbooks("2.xls").Sheets(1).Name = Format(Date - 1, "mm-dd-yyyy")
 
Upvote 0
Response to VonPookie

Thank you. When I use your suggestion the script does not run. Can you tell me how I am supposed to apply your solution? I am using windows notebook and saving as a .vbs file to run from outside of Excel.
 
Upvote 0
Oh. I don't know anything about VBS. I thought you had simply used the wrong term in your subject when you meant "VB script".

At any rate, what I posted is VBA. VBS is a completely different animal, I believe. I'll move this to another part of the forum where it might go better.
 
Upvote 0

Forum statistics

Threads
1,225,327
Messages
6,184,301
Members
453,227
Latest member
Slainte

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