View Single Post
 
Old 11-02-2021, 05:06 PM
Guessed's Avatar
Guessed Guessed is offline Windows 10 Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,177
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

I would guess that your real doc has more than one type of hyphen/n-dash/m-dash showing the spans so perhaps you might consider picking all of them up with a wildcard
.Text = "[-–—]{1}[0-9]{1,3}"

In which case you can get int1 more simply by just truncating the initial character
int1 = CInt(Mid(aRng.Text, 2))

And If int1 > 7 And int1 < 10 Then would more logically be
If int1 = 8 or int1 = 9 Then

And you can combine the code from both passes into one macro by copy/paste or create a third macro that calls both the others
Code:
Sub RunBoth()
  FindTemplateToPage
  FindTemplateToPageDash
End Sub
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote