用于替换全部的“Excel VBA代码”。 ,“在一列 [英] Excel VBA code for replacing all "." by "," in a column

查看:600
本文介绍了用于替换全部的“Excel VBA代码”。 ,“在一列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要一个excel VBA宏来取代所有的。 (点)由,(逗号)在一张表中的列。



当我尝试使用以下代码执行它,只有当单元格值是。但不能取代。内部单元格值(即:1.16应该在sheet5中的列D中变为1,16)

  Sub ReplaceDoTwComma()

工作表(Sheet5)。列(D)。替换_
什么:=。,替换:=,,_
SearchOrder:= xlByColumns, MatchCase:= True

End Sub

有人可以给我很好的代码这样做?



提前感谢...

解决方案

添加 LookAt:= xlPart 选项。

 工作表(Sheet5 ).Columns(D)。替换_ 
什么:= seek,replacement:= replaced,LookAt:= xlPart


I would like to have an excel VBA macro in order to replace all "." (dot) by "," (comma) in a column in one sheet.

When I try to do it with the following code, it replaces only if the cell value is ".". But does not replace "." inside cell value (i.e : 1.16 should be turned to 1,16 in column D inside sheet5)

Sub ReplaceDoTwComma()

Worksheets("Sheet5").Columns("D").Replace _
What:=".", Replacement:=",", _
SearchOrder:=xlByColumns, MatchCase:=True

End Sub

Can someone give me the good code to do this?

Thanks in advance...

解决方案

Add the LookAt:=xlPart option.

    Worksheets("Sheet5").Columns("D").Replace _
        What:=sought, replacement:=replaced, LookAt:=xlPart

这篇关于用于替换全部的“Excel VBA代码”。 ,“在一列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆