如何在select case语句中包含多个列

时间:2017-01-09 17:08:45

标签: excel vba excel-vba

我做了一个我在组合框中使用的精选案例陈述。请参阅下面的代码。但是在提供的示例中,我一次只能使用一列我尝试过几个例子。最终结果将是"当前月份"选择使用列" C"和" S"。

尝试1:

 <dependency>
        <groupId>org.apache.spark</groupId>
        <artifactId>spark-streaming-kafka-0-8_2.11</artifactId>
        <version>2.0.0</version>
    </dependency>


    <dependency>
    <groupId>org.apache.kafka</groupId>
    <artifactId>kafka-clients</artifactId>
    <version>0.9.0.0</version>
</dependency>

尝试2:

nExtend = 1 'Set this as a default.
Select Case MonthComboBox.value
    **Case "Current Month"
        iCol = "C"
    Case "Current Month"
        iCol = "S"**
    Case "Current Month +1"
        iCol = "N"
        nExtend = 5
    Case "Current Month +2"
        iCol = "O"
        nExtend = 4
    Case "Current Month +3"
        iCol = "P"
        nExtend = 3
    Case "Current Month +4"
        iCol = "Q"
        nExtend = 2
End Select

实际代码:

nExtend = 1 'Set this as a default.
Select Case MonthComboBox.value
    ****Case "Current Month"
        iCol = "C" & "S"**
    Case "Current Month +1"
        iCol = "N"
        nExtend = 5
    Case "Current Month +2"
        iCol = "O"
        nExtend = 4
    Case "Current Month +3"
        iCol = "P"
        nExtend = 3
    Case "Current Month +4"
        iCol = "Q"
        nExtend = 2
End Select

1 个答案:

答案 0 :(得分:1)

我建议您更改Select Case语句,如下所示:

Activity

(您不会需要01-10 13:28:55.897 4847-4847/com.c.fragmentlifecycle D/MainActivity: onCreate: called 01-10 13:28:55.926 4847-4847/com.c.fragmentlifecycle D/MainFragment: onCreateView: called 01-10 13:28:55.929 4847-4847/com.c.fragmentlifecycle D/MainActivity: onResume: called 01-10 13:28:55.929 4847-4847/com.c.fragmentlifecycle D/MainFragment: onResume: called 01-10 13:28:55.929 4847-4847/com.c.fragmentlifecycle D/MainActivity: onCallback: called by fragment - 它已内置到您在Thread[] thread; protected override void OnStart(string[] args) { timer = new System.Timers.Timer(); timer.AutoReset = true; timer.Enabled = true; timer.Interval = 1000 * 45; timer.Start(); timer.Elapsed += Timer_Elapsed; servisList = new List<IService>() { new ShiftNotification(), new ActiveDirectoryService(), new DirectoryPhotos() }; thread = new Thread[servisList.Count]; } private void Timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) { try { for (int i = 0; i < servisList.Count; i++) { if (thread[i] == null) { if (TimeControl.CheckTime(DateTime.Now, servisList.ElementAt(i).sProps)) { thread[i] = new System.Threading.Thread(new System.Threading.ThreadStart(servisList.ElementAt(i).NotifyUsers)); thread[i].Start(); } } else { if (thread[i].ThreadState != System.Threading.ThreadState.Running) { if (TimeControl.CheckTime(DateTime.Now, servisList.ElementAt(i).sProps)) { thread[i] = new System.Threading.Thread(new System.Threading.ThreadStart(servisList.ElementAt(i).NotifyUsers)); thread[i].Start(); } } } } } catch (Exception ex) { } } 中设置的列规范中。)

然后您的Select Case MonthComboBox.value Case "Current Month" iCol = "C:C,S:S" Case "Current Month +1" iCol = "N:R" Case "Current Month +2" iCol = "O:R" Case "Current Month +3" iCol = "P:R" Case "Current Month +4" iCol = "Q:R" End Select 循环都可以更改为

nExtend

您的完整修订代码如下:

iCol