Avatar of Luis Diaz
Luis Diaz
Flag for Colombia asked on

Excel VBA: retain values on a column based on string with 2 modes

Hello experts,

Following the questions resolved at:
I was wondering if we can cover the new requirement:
Have two modes modulated by an inputbox which allows me to retain prefix from left to right as is and another mode to retain prefix from right to left.

I attached the current procedure and the expected result for mode 1 and 2.

Thank you for your help.
Prefix_String.xlsm
Microsoft ExcelMicrosoft Office

Avatar of undefined
Last Comment
Luis Diaz

8/22/2022 - Mon
Bill Prew

I assume this is in relation to this prior question?


Can you explain a bit more about the new "right to left" option?  In the case of your example file that you attached, what string would you have entered to produce the results you want in column C?  Would it still be "test", and therefore you want to take everything from the LEFT up to and including the string entered in the prompt?  Or something else?


»bp
ASKER CERTIFIED SOLUTION
Bill Prew

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Luis Diaz

ASKER
Bill,

Would it still be "test", and therefore you want to take everything from the LEFT up to and including the string entered in the prompt?

Yes the string reported was test. The idea is to have two modes: 1 take the string reported from right to left and 2 take the string reported from left to right including the string reported.

Just one question prior to test. Should I report exactly the string in upper or lower case on the basis of string in the cell.
Example
I have in cell A2 123Id456 in order to get 123Id with mode 1 or Id456 with mode 2 should I report Id in the inputbox or can I report ID or id?

Thank you for your help.
Bill Prew

Your starting code that you posted ignored case, so that is true of the new change as well.
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
Luis Diaz

ASKER
Thank you very much Bill!
I tested and it works! Already added to my Add-in file.

Thank you again!

Regards,
Luis.