如何删除文字之间的空格? [英] How to remove spaces in between text?

查看:104
本文介绍了如何删除文字之间的空格?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么修整在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来做,但是在ltrimrtrim起作用时,它不起作用.

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的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.

这篇关于如何删除文字之间的空格?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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