VBA search for a character group

neveu

Board Regular
Joined
Jan 27, 2009
Messages
225
Hello,

would need your help to design a VBA code to search for several groups of characters and the extract a number of characters .

here is how my data looks like on one row:
OCN PLANTIN SPRL 30-MAR-11 713829 1708050 5081488 - Proj 11082 TAG T06R2046 CAR 10007

i have designed a formula to extract the string that starts with "T0" but i have an exception where the tag number is followed by point and another 2 digits for ex:
T06R2022.04; project 11153; CAR: TNT

i would need the result to be T06R2022.04

i looked at the data and unfortunatly there can be different character after the tag number it can be jsut space or semicolon or coma

i was thinking to solve this by inserting a search function that would determine if the 9th chracter is point or not; if it is then to copy also the next 2 digits.
Code:
For i = 8 To LR
        If UCase(Cells(i, 7).Text) Like "*T0*" Then
            Cells(i, LC + 3).Value = Mid(Cells(i, LC).Text, _
            Application.WorksheetFunction.Find("T0", UCase(Cells(i, LC).Text)), 8)
endif
next i
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Excel Workbook
G
43OCN ACCO 6299 - project 11072, TAG T06R1429, CAR 10007
44OCN HIG ELEKTROT: 11058 Tag: T06R1265 Car: 10007
45OCN ACCO BENELUX 111080, TAG T06R1434.12, Car 10007
46OCN BREUR 28-FEB-1G: T06R1262.45; CAR: Real estate
P02
Excel 2007
 
Upvote 0

Forum statistics

Threads
1,224,524
Messages
6,179,304
Members
452,904
Latest member
CodeMasterX

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