Extracting text using VBA

Kurt

Well-known Member
Joined
Jul 23, 2002
Messages
1,664
I have made some head and thanks to everyone's help so far.

I am using the same string of text:'

MECH~CDA-CUP-PF~1 - CUP0915.2XL - Copper Reducer (P)


How do I get the CDA-CUP-PF extracted using something like this?

Code:
    AddFormula TopLeft.Offset(1, 3).Resize(RowCount, 1), "=LEFT(AA" & Row & ",FIND(""#"",SUBSTITUTE(AA" & Row & ",""-"",""#"",2))-1)"
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
I dont know if you need a formula or just the result or where this value is found on the sheet. Heres one way based on what you have provided:

Code:
MsgBox Split("MECH~CDA-CUP-PF~1 - CUP0915.2XL - Copper Reducer (P)", "~")(1)
 
Upvote 0
I really need to keep using that formula format.

A MsgBox would not work since there are several thousand rows.

Thanks for your input.
 
Upvote 0
So you want a formula? Which cell is the string in and which cell is the formula going in?
 
Upvote 0

Forum statistics

Threads
1,213,489
Messages
6,113,953
Members
448,535
Latest member
alrossman

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