VBA唏嘘戏——简单单元格的设定(实例)
由于有很多个Word文件,所以应用宏会更加方便排版,而且版式较为统一。
Sub 设置列宽()
'
' 设置列宽宏
'
'
ActiveDocument.Tables().Cell(, ).Width = '将Word表格的第7行第2列(即B7单元格)的宽度设为45
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width = 70.5
ActiveDocument.Tables().Cell(, ).Range.Text = "" '将Word的表格第7行第17列单元格(Q7单元格)的值设置为空 ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width = 70.5
ActiveDocument.Tables().Cell(, ).Range.Text = "" ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width = 70.5
ActiveDocument.Tables().Cell(, ).Range.Text = "" ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width = 70.5
ActiveDocument.Tables().Cell(, ).Range.Text = "" ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width = 70.5
ActiveDocument.Tables().Cell(, ).Range.Text = "" ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width = 70.5
ActiveDocument.Tables().Cell(, ).Range.Text = "" ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width = 70.5
ActiveDocument.Tables().Cell(, ).Range.Text = "" ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width = 70.5
ActiveDocument.Tables().Cell(, ).Range.Text = "" ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width =
ActiveDocument.Tables().Cell(, ).Width = 70.5
ActiveDocument.Tables().Cell(, ).Range.Text = "" ActiveDocument.Tables().AllowAutoFit = False End Sub

VBA唏嘘戏——简单单元格的设定(实例)的更多相关文章
- 在Excel里用vba给合并的单元格添加注释
Excel里使用VBA对已经合并的单元格添加注释,直接使用AddComment会报: 运行时错误 '1004':应用程序定义或者对象定义错误 找了很多文章都没找到怎么解决,最后发现在AddCommen ...
- 【VBA】快速填充单元格
在Excle中,需要填充单元格,直接下拉,然后即可填充,但是使用VBA代码又该如何实现这个呢? 代码区域 Public Sub 快速填充() Dim myRange As range Cells.Cl ...
- 使用VBA将Excel指定单元格数据、字符串或者图表对象插入到Word模板指定书签处
准备工作: 1.首先需要提供一个word模板,并且标记好您要插入书签的位置,定义书签的命名.如图 2.模拟您要插入的Excel原始数据和图表对象 插入代码如下: Private Sub Command ...
- VBA赋值给指定单元格
这是一个Range对象基本操作实例,对指定单元格赋值,然后使用弹窗获取值. 代码如下: Sub test1() Worksheets( MsgBox "工作表Sheet1内单元格A5中的值为 ...
- html表格合并单元格的运用实例
效果图: 实现代码: <!DOCTYPE html><html><head><meta charset="UTF-8"><ti ...
- VBA对指定单元格填充颜色并且赋值
使用VBA对指定的单元格赋值并填充颜色 ====================================================== 代码区域 ==================== ...
- c# WinForm开发 DataGridView控件的各种操作总结(单元格操作,属性设置)
一.单元格内容的操作 *****// 取得当前单元格内容 Console.WriteLine(DataGridView1.CurrentCell.Value); // 取得当前单元格的列 Index ...
- 【表格设置】HTML中合并单元格,对列组合应用样式,适应各浏览器的内容换行
1.常用表格标签 普通 <table> | <tr> | | <th ...
- 转:c# WinForm开发 DataGridView控件的各种操作总结(单元格操作,属性设置)
一.单元格内容的操作 *****// 取得当前单元格内容 Console.WriteLine(DataGridView1.CurrentCell.Value); // 取得当前单元格的列 Index ...
随机推荐
- jQuery实践——选择器篇
一.基本 #id: html:<div id="demo1">demo1</div> jQuery:$("#demo1").css( ...
- iOS 使用Block进行逆传值
跟通知一样也是两个控制器,然后代码创建控件直接上代码 #import "ViewController.h" #import "TwoViewController.h&qu ...
- idea jrebel6 安装,破解
一.Setting中在线安装JRebel插件,install 二.拷贝下载的jrebel.rar解压后 把里面内容覆盖IDEA插件安装目录中此插件目录之下 下载:http://pan.baidu.co ...
- MySQL运算符和内置函数
1.字符函数 CONCAT('a','-','b','-','c')效果等同于CONCAT_WS('-','a','b','c') FORMAT()的返回结果是字符型,会对操作数四舍五入,如:SELE ...
- 使用vs2010创建、发布、部署、调用 WebService
原文地址:使用vs2010创建.发布.部署.调用 WebService作者:吴超 一 使用vs2010创建 WebService 1 打开VS2010,菜单 文件->新建->项目2 ...
- iOS - Push 通知推送
1.UserNotifications 通知是 App 用来和用户交流的一种方式,特别是当 App 并没有在前台运行的时候.通知,正如它的名称所强调的,被用作向用户'通知'一个事件,或者仅仅向用户提示 ...
- PBOC金融IC卡,卡片与终端交互的13个步骤,简介-第三组
七:终端风险管理-必选但包含可选步骤异常文件:终端检查应用主账号是否在异常文件列表(卡号黑名单)中.商户强制联机:商户可以将当前交易强制为联机处理.最低限额:控制交易当前交易金额或同一张卡片连续几笔交 ...
- 【转】 C++模板详解
C++模板 模板是C++支持参数化多态的工具,使用模板可以使用户为类或者函数声明一种一般模式,使得类中的某些数据成员或者成员函数的参数.返回值取得任意类型. 模板是一种对类型进行参数化的工具: 通常有 ...
- spring框架学习(五)注解
注解Annotation,是一种类似注释的机制,在代码中添加注解可以在之后某时间使用这些信息.跟注释不同的是,注释是给我们看的,Java虚拟机不会编译,注解也是不编译的,但是我们可以通过反射机制去读取 ...
- 【oracle】 oracle学习笔记1--安装与登录
由于机器配置原因,加上也是自学,所以就没必要安装专业版的oracle,于是就安装的oracle xe版本 下载地址:http://www.oracle.com/technetwork/database ...