How write over cell with VBA

Joxu

New Member
Joined
Nov 19, 2009
Messages
21
Hi
I have 2000 files where I need to write over one cell in each files. All these file are in same folder. All files are protected with password, and VBA are also Protected with password.
In every file have worksheet what are named "environ". On that sheet I need to change one cell value.
So my question is. How can do this, open file, open vba, unprotect file, write to each file to the environ worksheet D5 value 1. Then save files again with original names.

Is it possible?
-Joxu
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
How can do this, open file, open vba, unprotect file, write to each file to the environ worksheet D5 value 1. Then save files again with original names.
You should be able to get all of the code you need to do this (except looping through all files in the folder) with the Macro Recorder. Simply turn on your Macro Recorder, and record yourself doing all those steps manually.
The Macro Recorder is a great tool for getting this kind of code snippets.

To loop through all the files in the folder, you can use the code found here:
http://codevba.com/office/loop_files_in_folder.htm#.XPUQe_lKipo
So the code you recorded would just go inside that loop.

If you have any issues putting all together, post the code that you recorded here, and let us know the full file path of the folder where these files reside.
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,244
Members
452,622
Latest member
Laura_PinksBTHFT

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