GregFullington
New Member
- Joined
- May 2, 2018
- Messages
- 4
I have a series of patterns that I am searching for in a cell.
For each pattern I find in the cell, I want to parse the matching string and write it to a new row in a new worksheet, along with a key value in a separate cell.
I am writing a function in a module. I am able to use the like statement to determine if the pattern exists in the cell, but haven't found a solution to parse out the matching data. There will be multiple instances that I will want to extract.
If curCell.Value Like "*#####,*" Or c.Value Like "*#####.*" Or c.Value Like "*##### *" Or c.Value Like "*#####/*" Or c.Value Like "*#####x*" Or c.Value Like "*?####,*" Or c.Value Like "*?####.*" Or c.Value Like "*?#### *" Or c.Value Like "*?####/*" Then 'extract the data
Sample input data
A1 B1
Key1 MEDICAL RECORDS** please review for approval .. pc 81406 81479x12
Key2 PC'S/FC A0433 Y5400 A0425 MEDICAL RECORDS: *92138
Sample Output
A1 B1
Key1 81406
Key1 81479
Key2 A0433
Key2 Y5400
Key2 A0425
For each pattern I find in the cell, I want to parse the matching string and write it to a new row in a new worksheet, along with a key value in a separate cell.
I am writing a function in a module. I am able to use the like statement to determine if the pattern exists in the cell, but haven't found a solution to parse out the matching data. There will be multiple instances that I will want to extract.
If curCell.Value Like "*#####,*" Or c.Value Like "*#####.*" Or c.Value Like "*##### *" Or c.Value Like "*#####/*" Or c.Value Like "*#####x*" Or c.Value Like "*?####,*" Or c.Value Like "*?####.*" Or c.Value Like "*?#### *" Or c.Value Like "*?####/*" Then 'extract the data
Sample input data
A1 B1
Key1 MEDICAL RECORDS** please review for approval .. pc 81406 81479x12
Key2 PC'S/FC A0433 Y5400 A0425 MEDICAL RECORDS: *92138
Sample Output
A1 B1
Key1 81406
Key1 81479
Key2 A0433
Key2 Y5400
Key2 A0425