在excel中的当前行中的特定单元格中查找字符串

时间:2017-05-13 11:06:52

标签: excel excel-vba vba

我正在使用exel 2016并开始我的第一个vba脚本。我有一个excel文档,在B列的每一行中都有不同字符串的行。我想根据if条件填充D列。请参阅附图 Column B has entries filled, but I need to populate Column D I need Column D and E filled based upon what text I find in Column B, example text below

如何编写一个vba宏来对D列和E列运行,并在每一行读取B列中的条目,然后对写入答案做出判断,我正在思考像这样的伪代码:

Search for string in cell in Column B for current Row I'm on
If string contains "McDonald's"
then populate cell in column D for current Row as "Lunch" and in column E as "Visit". 
Move to next Row
Carry on with moving through Row's until you reach last Populated Row.

任何帮助都将不胜感激。

0 个答案:

没有答案
相关问题