Burrgogi
Well-known Member
- Joined
- Nov 3, 2005
- Messages
- 502
- Office Version
- 2010
- Platform
- Windows
I have a very simple but very repetitive task that I would like some help on.
I have a word that gets entered into sheet1, column A. It's a rolling list of words so today the last row is 50 but tomorrow the last row will be 51... the day after that will be row 52, etc,.
Whatever is entered there, I would like the macro to store that as a string variable and do the following:
1) Does the word end in 'Y?
If yes, then search for the word in ThisWorkbook.Sheets("Ends with Y") and mark that cell in bold font.
Otherwise, produce a message box indicating that the word was not found and exit sub
2) Does the word contain 'Y' anywhere in the string? EXCEPT for the last letter
If yes, then search for the word in ThisWorkbook.Sheets("Contains Y") and mark that cell in bold font.
Otherwise, produce a message box indicating that the word was not found and exit sub
There will be some cases where both conditions are met such as YUMMY in which case the search should be done in ThisWorkbook.Sheets("Ends with Y").
It's very simple to have the VBA macro to grab the last letter, using something like this: MyKeyWord_lastLetter = Right(c2, 1)
The problem is that the length of the word will always vary and that particular solution does not address 'Y' occurring in other parts of the string (beginning, middle, etc).
I have a word that gets entered into sheet1, column A. It's a rolling list of words so today the last row is 50 but tomorrow the last row will be 51... the day after that will be row 52, etc,.
Whatever is entered there, I would like the macro to store that as a string variable and do the following:
1) Does the word end in 'Y?
If yes, then search for the word in ThisWorkbook.Sheets("Ends with Y") and mark that cell in bold font.
Otherwise, produce a message box indicating that the word was not found and exit sub
2) Does the word contain 'Y' anywhere in the string? EXCEPT for the last letter
If yes, then search for the word in ThisWorkbook.Sheets("Contains Y") and mark that cell in bold font.
Otherwise, produce a message box indicating that the word was not found and exit sub
There will be some cases where both conditions are met such as YUMMY in which case the search should be done in ThisWorkbook.Sheets("Ends with Y").
It's very simple to have the VBA macro to grab the last letter, using something like this: MyKeyWord_lastLetter = Right(c2, 1)
The problem is that the length of the word will always vary and that particular solution does not address 'Y' occurring in other parts of the string (beginning, middle, etc).