目录
1 cells(行,列)
是一种找到单元格对象的方法,而不是单元格本身(经纬度工具)
2 range 选择含有变量的多个单元格
Range("A" & i & ":R" & i).Select
range(cells(),cells())
3 count 函数
For i=1 to Worksheet.Count
# ‘Worksheet的count的属性自动计算工作簿里边有多少个工作表
4 for ....next...
for i =1 to 20 step 1(step 1 可以省略)
循环语句
Next i
# step 不可以省略
for i =20 to 1 step -1(step 1 可以省略)
循环语句
Next i
5 if....else....多条件
If xxx==xxx And yyy<>yyy Then
<...>
ElseIf xxx==yyy Or xxx<=yyy Then
<...>
Else
<...>
End If
6. array() 返回一个数组
range("c5:d5").value = Array("date",`序号`)
7 Trim() 只会删除字符串两边的空格
Dim a, s
s=" 大家 好 "
a=Trim(s)
# 显示a的时候在两边加上方括号,以便看清a两端是否有空格
MsgBox"["& a &"]"