本文介绍了如何删除文字之间的空格?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
为什么修整在VBA中不起作用?
Why trim is not working in VBA?
for i = 3 to 2000
activesheet.cells(i,"C").value = trim(Activesheet.cells(i,"C").value)
next i
无法删除文本之间的空格.
It is unable to remove the spaces in between the text.
hiii how ' even after trying trim the o/p is still these
hiii how
我需要删除多余的空格,所以我找到了Trim
来做,但是在ltrim
和rtrim
起作用时,它不起作用.
I need to remove the extra spaces so I found Trim
to do it but it is not working while ltrim
and rtrim
are.
推荐答案
与Excel不同.代替使用 Excel的Application.WorksheetFunction.Trim
函数.
Excel Trim将删除单词之间除单个空格之外的所有空格. VBA Trim将删除前导空格和尾随空格.
Excel Trim will remove all spaces except a single space between words. VBA Trim will remove leading and trailing spaces.
感谢MS将相同的关键字用于不同的功能.
Thank MS for using the same keyword for different functions.
这篇关于如何删除文字之间的空格?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!