Hello,
Being a newbie, I am looking for a macro that:
1) Searches the filename of the active workbook for a specific word
2) Takes the word found in (1) and adds this to another word (with one space between the words)
3) Prints the two words in uppercase in cell B2 of the workbook "Mainbook.xlsm" (which is already open in the background).
Example:
Assume that the specific word in (1) is "morning", "day" or "night"
Assume the "another" word in (2) is always "time"
Then, if the filename of the active workbook is, say, "Nowitsmorningagain.xlsm", the end result in cell B2 in "Mainbook.xlsm" should be "MORNING TIME"; or if the filename of the active workbook is, say, "What a beautiful day.xlsm", the end result in cell B2 in "Mainbook.xlsm" should be "DAY TIME"; or finally, if the file name of the active workbook is "Good night.xlsm", the end result in B2 in "Mainbook.xlsm" should be "NIGHT TIME". ( I guess some kind of a loop would be appropriate here).
As indicated, the filename of the active workbook can be more or less anything (and with no spaces), but the file name will always contain either morning, day or night, i.e. they will never occur together in the file name, only one of them will appear somewhere in the file name. It would be nice to get a message if the filename of the active workbook does not contain morning, day or night.
Does anyone have any suggestions how to code this simple example? Many thanks in advance!
Bookmarks