How JustAnswer Works:
  • Ask an Expert
    Experts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
  • Get a Professional Answer
    Via email, text message, or notification as you wait on our site. Ask follow up questions if you need to.
  • 100% Satisfaction Guarantee
    Rate the answer you receive.
Ask The-PC-Guy Your Own Question
The-PC-Guy
The-PC-Guy, Computer Manager
Category: Microsoft Office
Satisfied Customers: 2011
Experience:  20 years experience providing remote computer support
62934938
Type Your Microsoft Office Question Here...
The-PC-Guy is online now
A new question is answered every 9 seconds

I have a training document that has a sequence of numbers

This answer was rated:

I have a training document that has a sequence of numbers for each lesson. They are numbered A001, A002, A003, etc. (they are not a numbered list). Is there a way to Find and Replace the entire sequence of them besides manually changing them to their new numbers (A219, A220, A221, etc.)?
JA: What kind of computer do you have?
Customer: Windows, the OS is 10 and it's Word 16.
JA: Have you installed any updates recently?
Customer: Yes.
JA: Anything else you want the Microsoft Office expert to know before I connect you?
Customer: No, that's it.

Thanks for using JustAnswer. My name is***** will do whatever I can to answer your question and will be back in a moment with my reply.

you can manually find and replace for each number

find 001 replace with 101 or whatever

then find 002 and replace with 102

ect...

or are you looking to automate it so that it does all of the finds and replaces with one function?

Customer: replied 2 months ago.
I'm looking to replace with one function through an automated solution.

what kind of document is this, is it a word doc or excel or some other program?

Customer: replied 2 months ago.
It's a Word document.

ok

a macro can be written to achieve this. The problem being is how are you going to tell the macro which values you want to change and what you want to change them to

Customer: replied 2 months ago.
I am looking for a macro solution. The values to be changed would be A001, A002, A003..... to A219, A220, A221.... Does this help?

can you give me a complete range of values and the range to be changed too?

for example a0001 - a221 is the range

and they would be changed to

b5000 - b6000 or whatever?

get the idea?

Customer: replied 2 months ago.
Please find the attached.

i c

I am sending an offer for additional service to cover the cost of this

The-PC-Guy and other Microsoft Office Specialists are ready to help you
Customer: replied 2 months ago.
Accepted the offer.

ok need some time to work on it

Customer: replied 2 months ago.
Not a problem. A day or two?

paste this code into your word document via the visual basic editor and run it,

there are a few things you need to do before running it,

1. first copy your excel file into the same folder as your word document, this is mportant

2. in the code there is a variable called Fname you will need to change the value in the quotes to the name of your excel file, this is important or it will not work

Sub fandrseq()
On Error Resume Next
Application.DisplayAlerts = False
Application.ScreenUpdating = False

Const xlup = -4162
Dim xlApp As Object
Dim xlBook As Object
Dim strName As String
Dim f As String
Dim r As String
Dim lr As Long
Dim i As Long

Set xlApp = CreateObject("Excel.Application")
Fpath = ActiveDocument.Path & "\"
FName = "test.xlsx"

Set xlBook = xlApp.Workbooks.Open(Fpath & FName)
xlApp.Visible = False
lr = xlBook.Worksheets(1).Range("A1").CurrentRegion.Rows.Count
For i = 1 To lr
f = xlBook.Worksheets(1).Range("A" & i).Value
r = xlBook.Worksheets(1).Range("B" & i).Value
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = f
.Replacement.Text = r
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
Next i
xlBook.Close

Application.DisplayAlerts = True
Application.ScreenUpdating = True

End Sub

Customer: replied 2 months ago.
Ok, will do and will follow up with you.
Customer: replied 2 months ago.
Worked perfectly! Thank you for taking the time to build this macro.