Quantcast
Channel: Active questions tagged excel - Stack Overflow
Viewing all articles
Browse latest Browse all 88066

How do I remove after a specific text and before a number, then delete duplicates using VBA?

$
0
0

So I'm trying to create a VBA Code where all you have to do is push a button and it automatically cuts a text string specifically and deletes duplicates then shows the results in another column.

For example of what I'm looking to accomplish, in Column A will be the text string and in Column B will be the result:

A

TEST_TESTING_COMPUTER_1x1_1x1_TEST_111111_MN_2222222_VVVVV_WWW_GGGG_LLLL_TEXTFORMAT1x1

The result I want to accomplish is:

B

111111_MN_2222222_VVVVV_WWW_GGGG_LLLL_TEXTFORMAT

And if another item in B is exactly like the result above it would automatically search for all duplicates and delete them. There doesn't need to be any blank spaces in B everything can be moved right underneath each other.

The Column A will always have the same amount of underscores but the 1x1 can change to 50x300, 700x700, 200x23, etc. I've figured out how to go about deleting everything prior to the 6th _ but haven't put it into VBA format. I'm also at a loss of how I would go about deleting the very end portion as it does vary. The code I have to delete everything prior is:

=RIGHT(SUBSTITUTE(A1,"_",CHAR(10),6),LEN(A1)-FIND(CHAR(10),SUBSTITUTE(A1,"_",CHAR(10),6),1)+1)

The number of rows that Column A could have anywhere near 5000 to 15000 lines.

Any help would be much appreciated!


Viewing all articles
Browse latest Browse all 88066

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>