www.zbgf.net > 用VBA sElECt CAsE语法

用VBA sElECt CAsE语法

Private Sub CB1_Click() Select Case Sheet1.Range("A1") Case "A" Sheet1.Range("A3") = "联想" Case "B" Sheet1.Range("A3") = "华硕" Case "C" Sheet1.Range("A3") = "惠普" Case "D" Sheet1.Range("A3") = "IBM" Case "E" Sheet1.Range("A3...

123456789Sub test() bianliang = "fdbbdf" Select Case True Case bianliang Like "*bb*" Call BB Case Else Call CC End SelectEnd Sub

不明白你说的, 但你可以仿照下面的语法自己写 Case语句的语法如下: Select Case 测试表达式 Case Is 条件1 如果条件1为真时执行的语句 Case Is 条件2 如果条件2为真时执行的语句 Case Is 条件N 如果条件N为真时执行的语句 End Select 例如,我...

Select Case语句也是条件语句之一,而且是功能最强大的条件语句。它主要用于多条件判断,而且其条件设置灵活、方便,在工作中使用频率极高。本节介绍Select Case语句的语法及应用案例. Select Case语句的语法如下: Select Case testexpression...

'如果一定要使用SELECT CASE,建议这样写 Select Case Range("a1") Case Is < 0: MsgBox "z" Case 0 To 10: MsgBox "a" Case 11 To 15: MsgBox "b" Case 16 To 20: MsgBox "c" Case 21 To 30: MsgBox "b" Case 31 To 40: MsgBox "c" Case Is > 4...

Sub lll() Dim I, G For I = 2 To 10 G = CStr(Range("A" & I)) Select Case Mid(G, Len(G) - 1, 1) Case 1 Case 2 Range("C2") = Range("A" & I) Case 3 Case 4 Range("C3") = Range("A" & I) Case 5 Case 6 Case 7 Range("C4") = Range("A" & ...

你一直检查到X,那么结果保存到Z吧,空一列,你可以修改为X,代码如下: Sub 宏1() dim i,j,r i=3 '从第三行开始 while cells(i,1)"" r="" for j=6 to 24 if cells(i,j)0 then r=r & chr(64+j) next j cells(i,"Z")=r i=i+1 wendEnd Sub

Case Is > 0.7, Is

推荐你使用“like”函数,比如 if rng1 like “*你好*”。这就是表示rng1里面包含你好两个字。不过是连续的!祝您愉快!

Case "January" 字符串要加半角双引号

网站地图

All rights reserved Powered by www.zbgf.net

copyright ©right 2010-2021。
www.zbgf.net内容来自网络,如有侵犯请联系客服。zhit325@qq.com