《学会VBA,菜鸟也高飞!》PDF电子书免费下载

作者:  林书明 邓志伟

出版社: 电子工业出版社 [1]

出版年: 2013-10

ISBN: 978-7-121-21506-3

目录

第1章 VBA是什么........................................................................................1
1.1 Excel的身体结构........................................................................................2
1.2 放下包袱轻松学习.....................................................................................6
1.3 通俗计算机工作原理..................................................................................7
第2章 第一个VBA程序 ................................................................................11
2.1 设计第一个VBA程序................................................................................11
2.2 打开含有VBA的程序................................................................................17
2.3 VBA代码放置的位置................................................................................20
2.4 其实你早就在“编程”............................................................................25
第3章 VBA中的等号...................................................................................30
3.1 VBA中等号的第一种含义........................................................................30
3.2 VBA中等号的第二种含义........................................................................32
第4章 VBA编程再探索 ................................................................................34
第5章 正式开始VBA编程之旅......................................................................43
5.1 单调的事情重复做...................................................................................48
5.2 从简单的程序开始...................................................................................53
5.3 一点点修改...............................................................................................53
5.4 增加一点颜色...........................................................................................56
5.5 让VBA代码更简洁....................................................................................60
5.6 单个单元格的引用...................................................................................63
5.7 单元格区域的引用...................................................................................63
5.8 用Excel宏替我们写代码...........................................................................65
第6章 VBA是一种语言................................................................................71
6.1 条件结构...................................................................................................71
6.2 分支结构...................................................................................................77
6.3 循环结构...................................................................................................80
6.3.1For…to循环......................................................................................................80
6.3.2For Each…循环................................................................................................81
6.3.3Do Until…循环.................................................................................................83
6.3.4 追踪程序的执行...............................................................................................85
6.3.5 跳出循环.........................................................................................................86
6.3.6 强制中断程序的执行.......................................................................................88
6.3.7VBA真的很简单...............................................................................................89
第7章 Excel就是小怪兽..............................................................................91
7.1 VBA是魔法师的咒语................................................................................92
7.2 小怪兽的“身体结构”............................................................................95
第8章 对象!对象!!................................................................................98
8.1 属性、方法、事件.................................................................................101
8.1.1 属性................................................................................................................102
8.1.2 方法................................................................................................................103
8.1.3 事件................................................................................................................103
8.1.4 事件参数Target和Cancel................................................................................108
8.2 Workbook事件.........................................................................................111
8.2.1Workbook的Open事件.....................................................................................112
8.2.2Workbook的BeforeClose事件..........................................................................114
8.2.3Open和BeforeClose配合使用..........................................................................115
8.3 Worksheet事件........................................................................................117
8.3.1Worksheet的Calculate事件.............................................................................117
8.3.2Worksheet的SelectionChange事件...................................................................118
8.4 Application事件......................................................................................120
8.4.1OnTime事件....................................................................................................121
8.4.2OnKey事件......................................................................................................122
8.5 对象就是小动物.....................................................................................124
8.6 探索Excel对象........................................................................................124
8.7 案例:让Excel自动工作.........................................................................130
8.8 Excel中的集合对象................................................................................136
第9章 VBA变量类型.................................................................................140
9.1 数值变量.................................................................................................143
9.2 字符串变量.............................................................................................143
9.3 对象变量.................................................................................................144
9.4 使用对象变量的好处..............................................................................145
9.4.1 代码简洁,程序高效......................................................................................145
9.4.2 提供自动提示功能.........................................................................................146
9.5 数组变量.................................................................................................147
9.5.1 一维数组变量.................................................................................................149
9.5.2 二维数组变量.................................................................................................151
9.5.3 数组与单元格区域.........................................................................................154
第10章 Sub子程序...................................................................................157
10.1 子程序示例...........................................................................................157
10.2 调用子程序...........................................................................................161
第11章 Function(函数) .........................................................................164
11.1 VBA自带的函数...................................................................................165
11.1.1VBA测试函数.............................................................................................167
11.1.2VBA字符串函数.........................................................................................167
11.1.3VBA数学函数.............................................................................................168
11.1.4VBA转换函数.............................................................................................168
11.1.5VBA时间函数.............................................................................................169
11.1.6VBA内置函数示例.....................................................................................170
11.2 自定义函数...........................................................................................172
11.2.1 工作表名称列表.........................................................................................173
11.2.2 获取当前工作表的名称..............................................................................176
11.2.3 分离字符和数字.........................................................................................177
11.2.4 数单元格颜色.............................................................................................180
11.2.5 连接区域中的字符.....................................................................................182
11.2.6 一对多查找.................................................................................................184
11.3 Sub和Function的区别...........................................................................186
11.3.1 如何调用子程序和函数..............................................................................189
第12章 VBA初学者容易走的弯路 ..............................................................195
12.1 充分调用内置功能................................................................................196
12.2 声明对象类型.......................................................................................199
12.3 利用录制宏探索对象............................................................................201
12.3.1 宏不能录制VBA语句..................................................................................204
12.3.2 集合对象的操作.........................................................................................205
12.3.3End()函数....................................................................................................207
12.3.4CurrentRegion属性......................................................................................208
12.3.5UsedRange属性...........................................................................................208
12.3.6Offset()........................................................................................................209
12.3.7Union()函数.................................................................................................211
12.3.8Split()和Join()函数......................................................................................212
第13章 VBA程序调试...............................................................................214
13.1 单步执行(F8键)...............................................................................215
13.2 设置断点(F9键)...............................................................................216
13.3MsgBox..................................................................................................217
13.4 Stop.......................................................................................................218
13.5 更多......................................................................................................219
第14章 经典VBA代码详解 ........................................................................220
14.1 拆分工作表...........................................................................................220
14.2 拆分工作簿...........................................................................................227
14.3 合并工作表...........................................................................................228
14.4 FileDialog对象......................................................................................230
14.5 合并工作簿...........................................................................................234
14.6 操作图表...............................................................................................236
14.7 批量制作表格.......................................................................................247
第15章 综合案例......................................................................................250
15.1 程序流程...............................................................................................251
15.2 界面设计...............................................................................................254
15.2.1 制作“货物发票”表格..............................................................................254
15.2.2 命名“单元格区域”..................................................................................254
15.2.3 建立“数据库”文件..................................................................................258
15.3 程序设计...............................................................................................259
15.3.1 清空发票数据.............................................................................................260
15.3.2 保存到数据库.............................................................................................262
15.3.3 调用子程序.................................................................................................267
结语:VBA,无他,唯手熟尔!..................................................................271
附录A Excel快捷键....................................................................................273

下载价格:免费
立即下载
登入/注册
知识就是力量
没有账号? 忘记密码?