这是一个excel VBA小程序,目的是检查演员名单不会出现在连续的三个节目之中。
这是样表:
首先,将原表格保存为带宏的格式.xlsm,然后Alt+F11调出VBA界面。
然后在相应的表格(和表单)中,创建module, 创建process (sub)。
运行的结果是,如果某个节目中的演员没有出现在后一、二、三个节目中,F列就会写上TRUE,否则为False,并且会把重复出现的演员的电子邮箱写在I列。
Sub DancerNotInNextThreePerformances()
Dim verify As Boolean
verify = True 'verify true means dancers are NOT in the next three rows
Dim CellRef As Range
Dim i As Integer
'loop
For i = 2 To 19
verify = True
Set CellRef = Worksheets("verify").Range("D" & i)
Worksheets("veri