用于删除前导空格的宏 [英] Macro to remove leading spaces
本文介绍了用于删除前导空格的宏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我对VBA不太熟悉。 我所知道的,我从记录宏中收集,然后再检查它们。 我正在尝试在导入数据库之前清理数据。 我运行了一次这个宏并且它运行了,但是我不得不手动
退出,因为它似乎循环并且不断重复。 现在它抛出一个错误:
编译错误:没有下一个。
I am not very experienced with VBA. What I know, I've gathered from recording Macros and then examining them afterwards. I'm trying to clean up data before I import into a database. I ran this Macro once and it worked, but I had to manually exit because it seemed to loop and keep repeating itself. Now it's throwing an error: Compile Error: For without Next.
调试器中突出显示了第一行。
The top line is highlighted in the debugger.
非常感谢您解决问题的任何线索!
Many thanks for any clue to the problem!
SME
推荐答案
你好Sr.MiriamE,
Synatx错误:
 缺少"下一个" for"For Each"...
 像这样修改  
Hi Sr.MiriamE,
Synatx error:
Missing "Next" for "For Each"...
Modify like this
For Each Rng In WorkRng
Rng.Value = VBA.LTrim(Rng.Value)
Next
End Sub
问候,
Ashidacchi
Regards,
Ashidacchi
这篇关于用于删除前导空格的宏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文