简体   繁体   English

使用VBA for Excel,我要使文本加粗

[英]Using VBA for Excel i want to make the text bold

I want a macro to find all the words written a column in another excel & make them bold. 我想要一个宏来查找另一个excel中写在列中的所有单词并使它们加粗。

For EX: I have Words like new, grow, etc written in a column B of Excel an the macro has to Find theses words individually in another excel & make them bold and change the Background of the cell to Red Color. 对于EX:我在Excel的B列中有新词,增长词等,宏必须在另一个excel中分别查找这些词并将其加粗,并将单元格的背景更改为红色。

Thanks in Advance. 提前致谢。

You may want to have a look into conditionnal formatting. 您可能想看看条件格式。

Assume for example you have the values you want to look for in column B, and you want to highlight all values in a range, say, D4:F15 . 例如,假设您具有要在B列中查找的值,并且想要突出显示范围内的所有值,例如D4:F15

Select the range D4:F15 , make a new formatting rule and choose "Use a formula to determine which cells to format". 选择范围D4:F15 ,制定新的格式设置规则,然后选择“使用公式确定要格式化的单元格”。 Enter =ISNUMBER(MATCH(D4;$B:$B)) as formula, and make the format as you wish. 输入=ISNUMBER(MATCH(D4;$B:$B))作为公式,并根据需要设置格式。 Note that D4 in the formula has to be the first cell of the range. 请注意,公式中的D4必须是该范围的第一个单元格。

If you don't need more than that, the benefit is that you don't need a macro at all, and the formatting can be done in real time too. 如果您不需要的更多,那么好处就是您根本不需要宏,并且格式化也可以实时进行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM