REM注释
表单操作
http://www.360doc.com/content/17/1112/16/1353678_703173128.shtml
https://blog.csdn.net/yaroo/article/details/78773414
教程
https://www.yiibai.com/vba/vba_for_loop.html
MsgBox WorksheetFunction.Count([a:a])
WorksheetFunction.CountA(Range(Cells(1, j), Cells(10, j)))
判断为空
If IsEmpty(Cells(i, 1))
在VBA代码中,如果要判断单元格A1是否为空单元格,也可以使用下列方法:
1. Cells(1, 1) = '' 或 Range(“A1”)= ''
2. Len(Cells(1, 1)) = 0 或Len(Range(“A1”))= 0
3. Cells(i, 1) = vbNullString 或Range(“A1”)= vbNullString
4. Application.WorksheetFunction.CountBlank(Cells(1,1))
5. 为了防止单元格中有空格,可以使用: Len(Trim(Cells(i, 1))) = 0
msgbox
https://www.cnblogs.com/mq0036/p/6169957.html
range("a1")
range("a1:a10")
range("a1:a10,b1:10,c1:10")
cells(1,2)
cells(1,"b")
cells(a1) ??
range("a1:a3").cells(1,1)
相对位置
for each a in selection
For 循环变量=初值 to 终值 step 步长。
for i=1 to 10
exit for
next
if then
elseif then
else
endif
sub xx()
end sub
function xx()
endfunction
Call CommandButton1_Click
方法一: call 函数(过程)名
方法二: 函数(过程)名
函数和递归
rivate Function Fibo(ByVal n As Integer) As Integer
'函数的返回值为第n个斐波那契数
If (n=0) Then
Fibo=0
ElseIf n=1 Then
Fibo=1
Else: Fibo=Fibo(n-1)+Fibo(n-2)
End If
End Function
For i = 2 To 20
If Cells(i, 1) = "" Then
Range(Cells(2, 1), Cells(i - 1, 6)).Select
Selection.Copy
Else
Exit For
End If
Next i