1、点击菜单“工具”-“宏”-“Visual Basic 编辑器”
2、得到某个sheet中某一个cell的内容 Sheet1.Range("A1").Text
3、循环
For Each c In Range("b2:c3819")
For Each d In Range("k2:k72")
Mypos = InStr(c, d)
if(Mypos)
Next
c.Value = i
Next
4、判断
if cells(6,2)=1 then cells(7,3)=cells(7,8) elseif cells(6,2)=2 then cells(7,3)=cells(8,8) elseif cells(6,2)=3 then cells(7,3)=cells(9,8) endif
5、对话框
MsgBox "你好,胖猫"
6、获取某一位置的行列
cells(2,7).select
row_num=activecell.row
column_num=activecell.column
7、选择某一行
Sheets(
"Sheet1"
).Range(
"A"
& (r + 1)).
Select
8、从sheet1中查sheet2重复的值,并在sheet1中c列置为1
For Each a In Sheet1.Range("b2:b99261")
For Each d In Sheet2.Range("d2:d13869")
If a = d Then
r = a.Row
Sheet1.Range("c" & r) = 1
End If
Next
Next