Can you batch edit (change) 100 identical spreadsheets?

I have 100 or so identical spreadsheets in a directory. Identical layout but different entries in each spreadsheet. I need to format a number of cells to "shrink to fit." Is there a way to batch edit that many spreadsheets?

In the alternative, I created a macro to do a single spreadsheet. How do I save it in the directory so that anyone bringing up a spreadsheet in that directory can run that macro?
LVL 1
Bill GoldenExecutive Managing MemberAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Panagiotis ToumpaniarisSystem EngineerCommented:
You can use VBA to do that.

This code will set shrink to fit to true for the first column.
Sub test()
Range("A:A").ShrinkToFit = True
End Sub

Open in new window


To make this work for many workbooks follow the guides here : https://www.rondebruin.nl/win/s3/win010.htm

hope it helps
Panagiotis
0
huacatCommented:
Just use the vbs to do it.

The VBS script like below codes(not test yet):
  Dim xpp, book, fso, files
  Set xpp = CreateObject("Excel.Application")
  Set fso = CreateObject("Scripting.FileSystemObject")
  Set files = fso.GetFolder("Your Folder which store 100+ Excel Files").files
  For Each f In files
    book = Application.Workbooks.Open(f)
    ' change the sheet name and range as you want
    book.Sheets("Sheet1").Range("A:A").ShrinkToFit = True
    book.Save
    book.Close
    Set book = Nothing
  Next
  Set files = Nothing
  Set fso = Nothing
  xpp.Quit

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Panagiotis ToumpaniarisSystem EngineerCommented:
Both ways work.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Spreadsheets

From novice to tech pro — start learning today.