Excel replacing data

I have 30 excel spread sheets with different data on each. I have a VB script that I run to move that data to a new spread sheet every month. Now I need to change a few lines on the script on all 30 spread sheets. I there a way to use some thing like find and replace to do this for all 30 at the same time or will I have to go in to all 30 sheets and replace the data 1 at a time. any help with this would be great. I am using Excel 2007. Thank you
jodyreidIT ManagerAsked:
Who is Participating?
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.

Professor JMicrosoft Excel ExpertCommented:
Yes, there is the option of find and replace in VBA module.  I didn't see any code attached, perhaps could be easy if you attach the code.
jodyreidIT ManagerAuthor Commented:
I did not attach any code but here is the code that I need to replace. Thank you
Professor JMicrosoft Excel ExpertCommented:
where do the the code to be replaced exist?  is it in module1 or is it in worksheet object module? or in class module?
Bootstrap 4: Exploring New Features

Learn how to use and navigate the new features included in Bootstrap 4, the most popular HTML, CSS, and JavaScript framework for developing responsive, mobile-first websites.

jodyreidIT ManagerAuthor Commented:
It is a Private Sub CommandButton1_Click(). When I press the button it runs the VB code.
Professor JMicrosoft Excel ExpertCommented:
so, is it exactly the same in all 30 workbooks?
Glenn RayExcel VBA DeveloperCommented:
Another possibility would be to add the original VBA code to your Personal Macro Workbook, replace the block of code, tweak anything else as necessary to generalize for all your sheets, and then just run the code from the PMW.  It would be available to you whenever you open Excel.

BTW, here is a slightly-cleaner version of the new code:
    ' Copy Totals from AI10 to AI37
    Selection.PasteSpecial Paste:=xlPasteValues

    ' copy Charge codes from B10 to B37
    Selection.PasteSpecial Paste:=xlPasteValues
    'Copy Number and paste to new data file
    Selection.PasteSpecial Paste:=xlPasteValues

    ' copy Date of services
    Selection.PasteSpecial Paste:=xlPasteValues
    Selection.NumberFormat = "m/d/yyyy"

Open in new window


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
jodyreidIT ManagerAuthor Commented:
Thank you.
Professor JMicrosoft Excel ExpertCommented:
Nice Glenn,  your solution is effective and easy.  i almost went the long way, and when i saw your post, i just discarded it.
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
Office Productivity

From novice to tech pro — start learning today.