Solved

Apply page setup on multiple excel files

Posted on 2011-09-13
3
193 Views
Last Modified: 2012-06-22
I have around 50 excel files and I want to change the page setup on all the files to have the same settings (Page margin, page orientation, column width, row width, etc).

What would be the best way to change the page setup on all files without manually change each file at a time?
0
Comment
Question by:coronoahcoro
3 Comments
 
LVL 4

Accepted Solution

by:
grogman earned 500 total points
Comment Utility
Simplest method I can think of (if you don't have much experience writing/modifying VBA code) would be to record a macro, store it in Personal Macro Workbook so it will be available regardless of open file, and while recording, set your page setup preferences exactly how you want them for the first file. Stop recording, then open each of the other files and run the recorded macro against them one at a time, saving changes to each file. This will automate the process of applying all of your settings. Granted, you will still need to open and save each file, but getting your page setup options applied will only take a couple of clicks.
0
 
LVL 2

Author Comment

by:coronoahcoro
Comment Utility
I have some experience with modifying VBA code. What would be the best way with VBA code?
0
 
LVL 4

Expert Comment

by:SafetyFish
Comment Utility
If, for instance, all the files are in a single folder you can write a loop to loop through all the files in the folder, check their extension for a .xls or .xlsm, etc, open them, apply the page setup settings change, save and close them again.

The only tricky part of this is getting the file location strings right, but that is generally not so hard.

http://vbatutor.blogspot.com/2009/02/excel-vba-macro-example-opening-closing.html

http://excelexperts.com/VBA-Tips-List-Files-In-A-Folder

Those should get you started :)
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
Recently Microsoft released a brand new function called CONCAT. It's supposed to replace its predecessor CONCATENATE. But how does it work? And what's new? In this article, we take a closer look at all of this - we even included an exercise file for…
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now