Avatar of Luis Diaz
Luis DiazFlag 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
Avatar of Bill Prew
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
Avatar of Bill Prew
Bill Prew

Blurred text
THIS SOLUTION IS 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
Avatar of Luis Diaz
Luis Diaz
Flag of Colombia image

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.
Avatar of Bill Prew
Bill Prew

Your starting code that you posted ignored case, so that is true of the new change as well.
Avatar of Luis Diaz
Luis Diaz
Flag of Colombia image

ASKER

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

Thank you again!

Regards,
Luis.
Microsoft Excel
Microsoft Excel

Microsoft Excel topics include formulas, formatting, VBA macros and user-defined functions, and everything else related to the spreadsheet user interface, including error messages.

144K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo