VBA无法删除空格 [英] VBA unable to remove the spaces
问题描述
for i = 3 to 2000
activesheet.cells(i ,C)value = trim(Activesheet.cells(i,C)。value)
next i
无论我如何尝试删除文本之间的空格
hiii how'即使在修剪后,o / p仍然是这些
hiii如何
有什么不对我做修剪了吗我只需要删除额外的空格,所以我发现修剪来做,但它的工作不正常,并且rtrim工作正常。
VBA 修剪
function 不同于Excel。使用 Excel的 Application.WorksheetFunction.Trim
function 。
Excel修剪将除去单词之间的单个空格之外的所有空格。 VBA修剪将删除前导和尾随空格。
感谢MS为不同的功能使用相同的关键字。
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
No matter how i try its unable to remove the spaces in between the text
hiii how ' even after trying trim the o/p is still these
hiii how
Is there anything wrong iam doing with trim ? I just need to remove the extra spaces so I found trim to do it but its not working well ltrim and rtrim are working fine
The VBA Trim
function is different than Excel's. Use Excel's Application.WorksheetFunction.Trim
function instead.
Excel Trim will remove all spaces except a single space between words. VBA Trim will remove leading and trailing spaces.
Thank MS for using the same keyword for different functions.
这篇关于VBA无法删除空格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!