Find and Replace data using an Excel Macro

I have an Excel file with multiple tabs. The format of each tab is the same.  I already have a loop set up that cycles through each tab and performs some procedures.  What I need to add to the loop is line of code that will find '2012' in cell B25 and replace it with '2015'.    What I mean by that is cell B25 in each tab has a 2012 date in it (for example: 12/16/2012 might be in cell B25 of one of the tabs).  I'm trying to include a line of code in the loop that would change 2012 to 2015. So, using the example above, 12/16/2012 would be changed to 12/16/2015.  Thanks
dbfromnewjerseyAsked:
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.

Subodh Tiwari (Neeraj)Excel & VBA ExpertCommented:
You may use something like within your loop, assuming you have declared a worksheet object variable...

Dim ws As Worksheet
For Each ws In Worksheets
    If IsDate(ws.Range("B25").Value) Then
        If Year(ws.Range("B25").Value) = 2012 Then
            ws.Range("B25").Value = DateSerial(2015, Month(ws.Range("B25").Value), Day(ws.Range("B25").Value))
        End If
    End If
Next ws
End Sub

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
Martin LissOlder than dirtCommented:
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
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
Microsoft Excel

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.