可以理解为salary 在不为空、有数值或者不超出范围的时候可以在Do中循环,直到salary 为空、没有数值或者超出范围后停止循环。If Not salary Is Nothing Then //如果找到 则运行以下程序Dosalary.Value = 1100 //替换Set salary = Selection.FindNext(salary) //继续查找Loop While not salary Is N...
Do While Not listCurrent Is Nothing '查找给定的值,如果当前值不是,则后移 With listCurrent If varItem >.Value Then Set listPrevious = listCurrent Set listCurrent = .NextItem Else Exit Do End If End With Loop '如果找到,则返回True If Not listCurrent Is...
Like Is 2. if not c is nothing 先运算 is 比较运算符,再进行not 逻辑非运算。 比较运算符,即Is运算符,可用于判断两个对象变量是否指向同一个对象,其语法为: 结果=对象1 Is 对象2 如果对象1和对象2都指向同一个对象,其结果为True;否则,结果为False。 还可以用Is运算符来判断一个对象变量是否符合要求,...
stkTest.Push"Excel"stkTest.Push"excelperfect"stkTest.Push"完美Excel"'出栈并打印元素值 Do While Not stkTest.StackEmpty Debug.Print stkTest.Pop()Loop Debug.Print"---"'入栈 stkTest.Push"测试"Debug.Print stkTest.StackTop End Sub 运行代码的结果如下图4所示。 图4...
Do Rng.Interior.ColorIndex = 6 '设置成黄色 Set Rng = .FindNext(Rng) Loop While Not Rng Is Nothing And Rng.Address <> FindAddress End If End With End If End Sub 代码解析:以上过程在工作表Sheets(“7”)的A列中查找InputBox函数对话框中所输入的值,并将查到单元格底色设置成黄色。
(inputt, lookat:=xlPart) 'xlpart表示单元格不同完全匹配' If Not r Is Nothing Then '当找到时' First = r.Address '用First记录下第一个单元格的地址' Do For i = 1 To Len(r) '对找到的单元格,从第一个字符到最后一个字符' If Mid(r, i, 1) = inputt Then '假如是inputt指定字符时,...
Do While Not listCurrent Is Nothing '查找给定的值,如果当前值不是,则后移 With listCurrent If varItem>.Value Then Set listPrevious=listCurrent Set listCurrent=.NextItem Else Exit Do End If End With Loop '如果找到,则返回True If Not listCurrent Is Nothing Then ...
Do While Not EOF(1) ' 循环至文件尾。 MyChar = Input(1, #1) ' 读入一个字符。 Debug.Print MyChar ' 显示到立即窗口。 Loop Close #1 下面这个函数可以将文本文件的数据一次读入到一个字符串(但是若包含中文时会出错,因为一个中文字占2个字节)。
4 Do WhileCells(I, 1) <> ""5 Cells(I,1).Select 6 TT =Cells(I, 1)7 Cells(I, 2) = ""8 9 SetFJX =Sheets("A").Range("A1:A"&Sheets("A").Range("A1").End(xlDown).Row).Find(TT,AFTER:=[A1],LOOKAT:=xlWhole)10 If NotFJXIs Nothing Then Cells(I, 2) = ...
Do While .Execute '如果能查找到 FindCount = FindCount + 1 '计数 If FindCount > 10 Then MyRange.InsertAfter " WeChat:NZ9668" '在查找到的文本区域后插入 End If GoTo 100 Loop End With Application.ScreenUpdating = True End Sub 代码截图: ...