excel学习库

excel表格_excel函数公式大全_execl从入门到精通

如何调试VBA代码的运行

分享成果,随喜正能量】道不用修,但莫污染。生活有数不尽的世事变迁,更有猜不透的变化无常,修一颗平常心,做好当下事,应对风云变幻。。

我给VBA下的定义:VBA是个人小型自动化处理的有效工具。可以大大提高自己的劳动效率,而且可以提高数据的准确性。我这里专注VBA,将我多年的经验汇集在VBA系列九套教程中。

作为我的学员要利用我的积木编程思想,积木编程最重要的是积木如何搭建及拥有积木。在九套教程中我给出了大量的积木,同时讲解了如何搭建。为了让学员拥有更多的积木,我开始着手这部《VBA即用型代码手册(汉英)》的创作这部手册约600页,集合约500多个的案例,案例我用汉语和英语同时发布,一方面学员从中可以更好的领会和掌握VBA中用到的一些英语知识,另一方面,大家可以看到各种各样的积木。这部手册是大家学习和工作中的不可多得的实用资料。今日的内容是:如何调试VBA代码的运行

第一章 如何调试VBA及Excel中调试VBA的方法

How to Debug VBA. Debugging VBA in Excel

编写 Visual Basic for Applications 代码很困难,如何编写有效的VBA代码并能快速编写呢?我经常发现许多大学都在努力让一些简单的程序发挥作用。我很惊讶他们中的大多数人更愿意坚持,试图找出导致他们问题的一行代码,而不是花几分钟学习如何正确调试Excel代码并更快地完成工作!这里我介绍关于如何调试VBA代码。

Writing Visual Basic for Applications code is hard, but what about writing VBA code that works and to write it fast? Often I found many colleges struggling to get a few simple procedures to work. I was amazed that most of them preferred to keep at it, trying to pin down the one line of code the causes their issues, rather then spend a few minutes learning how to properly debug Excel code and get the job done much faster! Introducing today’s post on how to debug VBA code!

调试本质上是定位和修复错误(或某些人喜欢称之为缺陷)并使之能有条不紊的运行的过程基本过程就是找到那个错误并杀死它! Excel VBA 与其他编程语言/环境相比有一个显着优势——您可以即时调试代码,而无需重新编译代码。这使我们的工作更轻松,调试更愉快!所以可以让我们直接进行。

Debugging is essentially a methodical process of locating and fixing bugs (or defects as some prefer). Basically find that bug and kill it! Excel VBA compared to other programming languages / environments has one significant advantage – you can debug code on the fly without having to recompile the code. This makes life much easier and debugging some much more pleasant! So let’s jump right to it.

1 调试VBA:基本术语Debug VBA: Basic Terms

首先,我们需要介绍一些基本术语,以方便本文的其余部分:

First we need to introduce some basic terms to facilitate the remaining part of this post:

执行/运行代码 – 运行宏的过程

Executing/Running code – the process of running a macro

调试代码 – 查找和修复错误/缺陷的过程

Debugging code– the process of finding and fixing bugs/defects

断点 – 宏执行将暂停的一行代码

Breakpoint – a line of code at which the execution of the macro will pause

(待续)

【分享成果,随喜正能量】我20多年的VBA实践经验,全部浓缩在下面的各个教程中:

分享成果,随喜正能量】把握了今天就把握了未来,把握了心态就把握了远方,把握了内心的氛围,就打开了通往未来的风景和时光。。

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

«    2024年12月    »
1
2345678
9101112131415
16171819202122
23242526272829
3031
控制面板
您好,欢迎到访网站!
  查看权限
网站分类
搜索
最新留言
    文章归档
      友情链接