Excel VBA
来源:互联网 发布:js protocol buffer 编辑:程序博客网 时间:2024/06/02 15:28
Dim sht As Worksheet '声明一个工作表类型的变量Dim IntCount As Integer '声明一个Integer变量IntCountDim sht As Worksheet, IntCount As IntegerDim Str As String 等价于 Dim Str$强制声明变量Option Explicit声明本地变量Sub Test1() Dim a As String Static b As IntegerEnd Sub声明一维数组Public | Dim 数组名称(a To b) As 数据类型该数组可保存数据的个数:(b-a+1)个。Dim arr(1 To 100) As ByteDim arr(99) As Byte '该数组有(99-0+1),即100个元素 'OPTION BASE 1声明多维数组Dim arr(1 To 3, 1 To 5) As IntegerDim arr(2, 4) As Integer声明动态数组Sub Test() Dim a As Integer '定义一个Integer类型的变量,名称为a '用工作表函数COUNTA求A列中的非空单元格个数,将结果保存在变量a中 a = Application.WorksheetFunction.CountA(Range("A:A"))End SubSub Test() Dim a As Integer '定义一个Integer类型的变量,名称为a '用工作表函数COUNTA求A列中的非空单元格个数,将结果保存在变量a中 a = Application.WorksheetFunction.CountA(Range("A:A")) Dim arr() As String '定义一个String类型的动态数组 ReDim arr(1 To a) '重新定义数组arr的大小End Sub3.5.81. 使用 Array函数创建数组Sub ArrayTest() Dim arr As variant arr = Array(3,8,1,9,6,4,7,5) MsgBox "arr数组的第2个元素为: "& arr(1)End Sub
0 0
- Excel Vba
- excel VBA
- Excel VBA
- EXCEL+VBA
- Excel VBA
- Excel VBA
- Excel VBA
- VBA Excel
- Excel中的VBA编程
- VBA for EXCEL FAQ
- Microsoft Excel VBA Examples
- Excel VBA 重要参考
- excel 问题,vba
- EXCEL VBA中的类
- Excel VBA教程
- 用VBA处理Excel
- Excel VBA笔记
- Excel VBA笔记2
- javaWEB总结(9):自定义HttpServlet
- oracle操作重做日志文件组
- Android开发获取设备硬件相关信息
- 联合体的用法与特点
- Spring源码分析之ioc注入
- Excel VBA
- Mongo学习笔记(一)
- 操作系统之——概述
- 坚持
- 欢迎使用CSDN-markdown编辑器
- 【C语言】详解栈帧
- linux信号机制
- Hibernate入门实例
- 编程之美读书笔记: 1.2 中国象棋将帅问题