如果该行中的一个单元格有红色文本,则为单元格着色
我通常会合并Excel文件输入,并检查是否发生了变化,人们以红色的单元格中突出显示。这意味着我必须从视觉上滚动整个Excel文件才能搜索这些红色单元格,以便丢失它们。 如果行中的单元格中有红色文本(或不是默认黑色的文本),是否可以在Visual Basic中将格式应用于行? 先感谢您 卡门
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
1。 在此处解决的所有文本都
在此处解决:
根据其他单元格的字体颜色更改单元格的值
2。查找带有红色的文本的单元格
您在此处找到的起点我如何在excel vba中的单元格中找到一个单词并为红色染色(只有整个单词不是整个单词使用VBA代码?
在此处完成了每个字符的检查:
3。创建用户定义的功能,
如果您创建一个用户定义的函数以搜索所需的格式,则可以过滤这些特定行。 (请参阅上面的nr1。link)
例如,它看起来像
= ifcoloredCells(a2:e2,“”,“ no Change”)
4。将更改应用于过滤的数据
过滤后的更改数据后,您可以根据您的whishes修改格式或数据。
1. Find cells which have all the text colored in red
Similar question solved here:
Change the value of the cell according to the font colour of the other cell
2. Find cells which have text partially colored in red
A starting point you find here How can I find a word in a cell in Excel VBA and color it red (only the word not the entire cell) using VBA code?
A check for every single character was done here: https://answers.microsoft.com/en-us/msoffice/forum/all/need-help-to-find-text-with-partial-font-color/b8e58634-b114-42fa-8f5f-fb83d9d3746d
3. create a user defined function
If you create a user defined function to search for the desired formatting you can filter for these specific rows. (see link at nr 1. above)
e.g. it could look like
=ifColoredCells(A2:E2," ","no changes")
4. apply changes to filtered data
After filtering for the changed data you can either modify the format or the data according to your whishes.
尝试以下代码:
您需要根据需要更改RNGDATA的设置。它即使在具有多个区域的范围内也可以工作(即使只有其中一个相交中只有一个具有红色字体的单元格,它仍然会使所有与给定行和任何区域的相交的字体红色变为红色)。
Try this code:
You'll need to change the setting of RngData accordingly to your need. It will work even on ranges with multiple areas (still it will turn the font red on all the intersections with a given row and any area even if only one of those intersection has 1 or more cells with red font).