[英]How can you write a VBA script to delete all cells in a range containing a certain string?
If I have a large range of cells, and I want to delete all cells containing just a "," or similar, how can I express this in code? 如果我有大量的单元格,并且我想删除所有只包含“,”或类似的单元格,我怎么能在代码中表达这个? I was thinking something along the lines of
我正在思考一些事情
If Range("C1:C100").Value = "," Then
Active.Cell.Delete Shift:=xlRight
I know this is terrible, but hopefully it gets my point across. 我知道这很糟糕,但希望它能让我明白这一点。
Thanks! 谢谢!
conceptually (not in front of Excel right now) 从概念上讲(现在不在Excel前面)
dim cel as range
for each cel in Range("C1:C100")
if cel.Value = "," Then
cel.Delete Shift:=xlRight
end if
next cel
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.