Macro/VBA to copy a range of data from a worksheet to a new workbook

oosag23

New Member
Joined
Dec 11, 2018
Messages
9
Please,can someone help me write a macro.
I have an“A.xls” workbook where I want to open then copy a range of data to “B.xlsx” file.

B.xlsxfile has the same format as a.xls so the data being copied will fit the samerange.

I then want to password protect the new workbook (B.xlsx) and rename andsave it as A.xlsx (same title as “A.xls” file). I need this to repeat for 400files that need this change.

Is it possible to dynamically
make this macro to fit for the next files eg. (A-1.xls to B-1.xlsx renamed to A-1.xlsx)

Anyassistance would be much appreciated.
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
Check the file that has the problem. You must remove it from your folder.
Or add this instruction to the start of the macro: On error resume next
 
Upvote 0

Forum statistics

Threads
1,224,827
Messages
6,181,195
Members
453,021
Latest member
pingpong7117

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