Writing a Regex Macro that - stores matches , compares matches , and merges exact and similar values

joellen

New Member
Joined
Sep 7, 2018
Messages
4


(?<word> \w{4,})
This is a php code that does exactly what I want my macro to do. String together characters a-z and 0-9 (not case sensitive) and match words when they are equal to or greater than 4 characters. I am not sure how to get this code into VBA's language. I need it to loop through a column, find matches, and compare those matches to each other. If they words are a 100% match in two cells I would like them to automatically combine values. If the matched words are similar in two cells, I want it to ask the user if they would like to merge these values together.


Ex:

[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Project Name[/TD]
[TD]Total Hours[/TD]
[/TR]
[TR]
[TD]Mowing the lawn[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]Watering the lawn[/TD]
[TD]3[/TD]
[/TR]
[TR]
[TD]Planting Trees[/TD]
[TD]5[/TD]
[/TR]
[TR]
[TD]Mowing the lawn[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]Planting Tree[/TD]
[TD]3[/TD]
[/TR]
</tbody>[/TABLE]


message box:
Planting Trees matched with Planting Tree, would you like to combine these Files? Yes=True No=False
If true, do
If false, do nothing

end result if user picked yes:

[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Project Name[/TD]
[TD]Total Hours[/TD]
[/TR]
[TR]
[TD]Mowing the lawn[/TD]
[TD]4[/TD]
[/TR]
[TR]
[TD]Watering the lawn[/TD]
[TD]3[/TD]
[/TR]
[TR]
[TD]Planting Trees[/TD]
[TD]8[/TD]
[/TR]
</tbody>[/TABLE]



end result if user picked no:


[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Project Name[/TD]
[TD]Total Hours[/TD]
[/TR]
[TR]
[TD]Mowing the lawn[/TD]
[TD]4[/TD]
[/TR]
[TR]
[TD]Watering the lawn[/TD]
[TD]3[/TD]
[/TR]
[TR]
[TD]Planting Trees[/TD]
[TD]5[/TD]
[/TR]
[TR]
[TD]Planting Tree[/TD]
[TD]3[/TD]
[/TR]
</tbody>[/TABLE]








</word>




 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.

Forum statistics

Threads
1,223,734
Messages
6,174,189
Members
452,550
Latest member
southernsquid2

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top