View Single Post
 
Old 02-05-2025, 05:15 PM
batman1 batman1 is offline Windows 11 Office 2013
Advanced Beginner
 
Join Date: Jan 2025
Posts: 57
batman1 is on a distinguished road
Default

Quote:
Originally Posted by gmaxey View Post
Batman1


I tested both of your proposed solutions. They both work with "durations defined

as 1 or more e.g., 1-BR, 1.5-US, 2.5-AP etc. However, if duration is < 1 e.g., .25-BR, .5-US or .75-UK they are not being detected by your RegEx expression.


Unable to find expression to work in all cases.
In the OP data I see 0.75-US, 0.5BR, 0.5AP, 0.25BR everywhere, so there is always at least 1 digit before the decimal separator. If we also accept .75-US, .5BR, .25BR, then just change:

1. In Sub highlight
Code:
re.Pattern = "^((?:\d*\.)?\d+)(?:|\-)" & code & ".*$"
2. In Sub highlight_cell
Code:
re.Pattern = "^((?:\d*\.)?\d+)(?:|\-)(US|UK|BR|AP).*$"
Reply With Quote