更换细胞B. Excel 床单到其他含义

我有一张纸 excel, 其中包含附近 900 数据行,我需要运行一个列并替换此列中的内容,另一个值,具体取决于当前列中的列。

例如,假设在列中说 F 输入以下值:

reg/& 航空运输

Adj / 航空 & 运输

Adj / 航空 & 运输

录取讲师ESL

Adj/ESL

reg/& 航空运输

教授 / 航空

航空教授

副教授,教授

教授

证明 / 航空 & 运输

客座教授

教授

教授

Adj / 航空

教授

Rezh Master Prog. - /DOC.

主席 / 同胞 Prof/Aviation&TS

副教授 / 航空

doc / 航空

Adj.Asst. 教授航空


我想贯穿此列,如果其中一个单元格包含值 "Aviation", 我想清除此单元格的内容并输入 "航空 & 运输".

如果有人可以向我展示如何完成这项任务,那将意味着整个世界!
已邀请:

君笑尘

赞同来自:

添加新列并将其填写在公式中:


=IF/NOT/ISERROR/SEARCH/"Aviation",B1///,"Aviation & Transportation",B1/


它是缺陷的,也许你需要一些纠正语法,因为我没有把它放进去 excel. 但它应该为您提供正确的方向。

小明明

赞同来自:

事实上,我有一个更好的解决方案。 您可以在菜单中使用通配符 Find..Replace.

点击 Ctrl F > Replace > Enter
*Aviation*

, 然后写下要替换单元格值的任何内容。 我检查了他,他工作。 您可以启用或禁用对寄存器的敏感性。

君笑尘

赞同来自:

试试吧


Sub replace//
Dim Rws As Long, Rng As Range, c As Range
Rws = Cells/Rows.Count, "F"/.End/xlUp/.Row
Set Rng = Range/Cells/1, 6/, Cells/Rws, 6//

For Each c In Rng.Cells
If c Like "*Aviation*" Then c = "Aviation & Transportation"
Next c
End Sub


您还可以在其代码中使用自动滤清器。 VBA.

开始
https://i.stack.imgur.com/P7xgg.jpg
结果
https://i.stack.imgur.com/G6S6f.jpg
使用autofiltrode代码。


Sub Button1_Click//
Dim Rws As Long, Rng As Range, c As Range
Rws = Cells/Rows.Count, "F"/.End/xlUp/.Row

Columns/"F:F"/.AutoFilter Field:=1, Criteria1:="=*Aviation*"
Set Rng = Range/Cells/2, 6/, Cells/Rws, 6//.SpecialCells/xlCellTypeVisible/
Rng.Value = "Aviation & Transportation"
ActiveSheet.AutoFilterMode = 0

End Sub

要回复问题请先登录注册