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...

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

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

'如果一定要使用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...

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

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" & ...

Case Is > 0.7, Is

现成的

如果是与的关系 嵌套判断,优先级高的放外层! Select Case 变量1 Case xxx Select Case 变量2 Case xxx Func End SelectEnd Select如果是或的关系 放Else里 Select Case 变量1 Case xxx Func Case Else Select Case 变量2 Case xxx Func End Sel...

Private Sub CommandButton4_Click() Dim a(7, 14) As Single Dim i, j As Integer For i = 0 To 14 For j = 0 To 7 a(j, i) = Sheets("可行性").cells(102 + 2 * j, 4 + i).Value Select Case a(j, i) Case 1 To 3599 a(j, i) = 1 Case 3600 To...

网站地图

All rights reserved Powered by www.zbgf.net

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