Auto Erase file's Internal Data

mmbhatti

New Member
Joined
Mar 5, 2023
Messages
8
Office Version
  1. 365
  2. 2019
  3. 2016
  4. 2010
  5. 2007
  6. 2003 or older
Platform
  1. Windows
  2. MacOS
  3. Mobile
  4. Web
Hello Excel Experts...
In my office, we have some excel files which re-used every year to collect and feed new data for the year. For this what we do is, make a copy of previously used Data file, delete previous entered data (except the rows/columns where formula exist), changes it's name and then save it with new year's name. In this way we make a fresh file for new use.
Now i want to manage it in vba code.
Is it possible that when make a copy of excel file, vba do the work in this way
First it check whether name of this file is changed, if yes, it ask for if I want to erase internal data or not. And do the work as we recommend.
...
I hope you understand my question...
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Good morning,

Just name the files with the year of work, then with VBA, when you change the year, you can easily open the old files from year N-1, rename them to year N and erase the data.

That said, the best would be to have model files to use each year by copying them and renaming them

Good Sunday
 
Upvote 0
Good morning,

Just name the files with the year of work, then with VBA, when you change the year, you can easily open the old files from year N-1, rename them to year N and erase the data.

That said, the best would be to have model files to use each year by copying them and renaming them

Good Sunday
I am newbie in VBA, can't write these codes...
What will be VBA for this...
 
Upvote 0
I have to go, but in the "Developer" toolbar you have the macro recorder to start helping you ;)
 
Upvote 0
Another solution would be to remove the data on the file (like you're starting a new year) and then save it as a Template. Call it Data Template, or something. That way you have a blank Template to use each year.
 
Upvote 0
Another solution would be to remove the data on the file (like you're starting a new year) and then save it as a Template. Call it Data Template, or something. That way you have a blank Template to use each year.
I want to make this as like a tricky file.. ☺️😜
When someone make copy of it and change its name, at first opening it should ask for if user want to continue from previous saved data or need a fresh file for fresh use.
 
Upvote 0
I want to make this as like a tricky file.. ☺️😜
When someone make copy of it and change its name, at first opening it should ask for if user want to continue from previous saved data or need a fresh file for fresh use.
No problem. You can save as a Macro Enabled Template. Then create a macro that changes file name on open with VBA. :)
 
Upvote 0

Forum statistics

Threads
1,215,734
Messages
6,126,547
Members
449,317
Latest member
chingiloum

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