Excel VBA 抢回我的空格键操作

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/17974664/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-11 22:30:45  来源:igfitidea点击:

Excel VBA snapping back my space bar action

excelvbaexcel-vbacomments

提问by Alexey

This is a weird question, but I could not formulate the question properly in Google.

这是一个奇怪的问题,但我无法在 Google 中正确地提出问题。

When I write comments in Excel-VBA, it for some reason snaps back my cursor on all space bar hits.

当我在 Excel-VBA 中写评论时,它出于某种原因将我的光标弹回到所有空格键上。

Example:

例子:

Dim Arr() As String 'This is |<-- When I hit the space bar, I expect the cursor to be here.

But if I am not quick enough, it snaps it back to 'This is|<-- Here

但如果我不够快,它就会回到 'This is|<-- Here

This is really bothering me because I have to constantly go back and forth in putting spaces in my lines of text that are space-less.

这真的让我很困扰,因为我必须不断地来回在我的无空格文本行中放置空格。

Some behavior: When type really fast, I think I am able to overshoot(?) the replacement, and it doesn't snap it back, but if I go slowly, it is faster than me. Also, if I hit space, it snaps back, I hit space, it moves the cursor, and now only after a 0.5 second delay it snaps it back again.

一些行为:当输入速度非常快时,我认为我能够超过(?)替换,并且它不会将其弹回,但是如果我慢慢来,它会比我快。此外,如果我点击空格,它会弹回,我点击空格,它会移动光标,现在只有在 0.5 秒延迟后它才会再次弹回。

I have Excel 2010.

我有 Excel 2010。

Anyone else had the same issue, or know how to fix it? It isn't a big thing, it is just annoying.

其他人有同样的问题,或者知道如何解决它?这不是什么大事,只是很烦人。

回答by jshrimp29

This likely wasn't the original issue, but for anyone else with this incredibly frustrating problem who also happens to use OneDrive - my problem was simply that a workbook I had open while I was editing VBA in my PERSONAL.XLSB was stored in a OneDrive directory. Once I moved it out of OneDrive, I stopped having the issue.

这可能不是最初的问题,但对于遇到这个令人难以置信的令人沮丧的问题并且碰巧使用 OneDrive 的任何其他人 - 我的问题只是我在 PERSONAL.XLSB 中编辑 VBA 时打开的工作簿存储在 OneDrive 中目录。一旦我将它从 OneDrive 中移出,我就不再遇到这个问题。

To determine this, I found that one particular workbook was causing the issue once the other answers didn't work for me, so I copied just the sheet I needed to a new workbook and saved. When this didn't work, I copied values+formatting to a new workbook and saved. When thatdidn't work, I copied just values to a new workbook and saved. Then, when I was just about to pull out what little remaining hair I have left, I copied the original offending file out of my OneDrive directory. And...voila.

为了确定这一点,我发现一旦其他答案对我不起作用,一个特定的工作簿就会导致问题,所以我只将我需要的工作表复制到新工作簿并保存。当这不起作用时,我将值+格式复制到新工作簿并保存。当不起作用时,我只将值复制到新工作簿并保存。然后,当我正要拔出剩下的一点点头发时,我从 OneDrive 目录中复制了原始的违规文件。还有……瞧。

回答by Pescolly

Turn on design mode in the developer tab.

在开发人员选项卡中打开设计模式。

回答by Dave Sexton

Try this:

尝试这个:

Tools Menu -> Options -> Editor Tab

工具菜单 -> 选项 -> 编辑器选项卡

Clear the Auto Syntax Check box

清除自动语法复选框