Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Excel VBA - delete string content after *word*

Tags:

excel

vba

I'm trying to delete string content before a certain word contained within the string. For example

[email protected]

I'd like to use VBA in order to replace that with

master_of_desaster

Everything after the "word" (@) should be removed, including the "word" itself.

I found a similar topic here, but he asks the opposite.

like image 918
Black Avatar asked Dec 10 '22 14:12

Black


1 Answers

email = "[email protected]"

ret = Left(email, InStr(1, email, "@") - 1)

Result: master_of_desaster

Thanks to Shai Rado

like image 142
Black Avatar answered Dec 22 '22 23:12

Black