图示EXCEL表格vba列88之ColorIndex=xlAutomatic

来源:人气:5更新:2024-07-19 06:00:13

在VBA的Excel表格中,当ColorIndex属性设置为xlAutomatic时,意味着该列的颜色会自动根据数据类型和预设格式进行填充。对于其他VBA相关知识的探索,用户可继续保持关注。

1、 首先建立一个空白的EXCEL表格,并设置简单的按钮控件,以便可以执行ColorIndex=xlAutomatic属性代码,如下图所示:

图示EXCEL表格vba列88之ColorIndex=xlAutomatic

2、 点击鼠标右键,进入到指定宏的界面下,新建模块,以便可以执行代码,如下图所示:

图示EXCEL表格vba列88之ColorIndex=xlAutomatic

3、 接下来就是进入到vba的project项目模式下,可以编写代码的界面,如下图所示:END1接下来就是编写代码,体现ColorIndex=xlAutomatic属性的代码编写,如下图所示:

图示EXCEL表格vba列88之ColorIndex=xlAutomatic

2、 代码:Sub Msg()Sheet1.Range("C2:D6").Borders(xlInsideVertical).ColorIndex = xlAutomaticEnd Sub体现ColorIndex = xlAutomatic属性的代码END1最后就是点击按钮控件,执行代码,显示结果,如下图所示:

图示EXCEL表格vba列88之ColorIndex=xlAutomatic

Copyright © 2008-2024